akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;

int a, b, c, d, e, f;
vector<int> w, s;



int main(){
  cin >> a >> b >> c >> d >> e >> f;
  for (int i = 0; i*a*100 <= f; i++){
    for (int j = 0; j*b*100 <= f; j++){
      int wa = i*a*100 + j*b*100;
      if (wa <= f && wa != 0) w.push_back(wa);
    }
  }
  for (int i = 0; i*c <= f; i++){
    for (int j = 0; j*d <= f; j++){
      int wa = i*c + j*d;
      if (wa <= f) s.push_back(wa);
    }
  }
  int test = (10000*e)/(e+100);
  int dens = 0;
  int ans1 = 0, ans2 = 0;
  rep(i, w.size()){
    rep(j, s.size()){
      if (w[i] + s[j] <= f){
        int tmp = (10000*s[j])/(w[i]+s[j]);
        if (tmp <= test){
          dens = max(dens, tmp);
          if(dens == tmp){
            ans1 = w[i]+s[j];
            ans2 = s[j];
          }
        }
      }
    }
  }

  cout << ans1 << " " << ans2 << endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

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

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define INT_MAX INT64_MAX
#define INT_MIN INT64_MIN
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
signed main(){
    int k, n;
    cin >> k >> n;
    int arr[n];
    for(int i=0; n>i; i++){
        cin >> arr[i];
    }
    int ans = abs(k-arr[n-1] + arr[0]);
    for(int i=1; n>i; i++){
        ans = max(ans, abs(arr[i] - arr[i-1]));
    }
    cout << k-ans << endl;
    
}






Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {


        long havingMoney = 100;
        long pastYear = 0;
        Scanner sc = new Scanner(System.in);
        long target = Long.parseLong(sc.next());

        while(havingMoney < target){
            havingMoney = (long) (havingMoney*1.01);
            pastYear++;
        }
        System.out.println(pastYear);
    }
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

//ａをbで割る
long long mod_div(long long a,long long b){
	long long tmp = MOD - 2,c = b,ret = 1;
	while(tmp > 0){
		if(tmp & 1){
			ret *= c;ret %= MOD;
		}
		c *= c;c %= MOD;tmp >>= 1;
	}
	return a*ret%MOD;
}

ll dp[3333][3333];

int main(){
	
	ll n,m;cin >> n >> m;
	vector<ll> v(n);
	REP(i,n)cin >> v[i];
	REP(i,n)REP(j,n)if(v[i] < v[j])dp[i][j] = 1;
	ll inv = mod_div(1, 2);
	
	REP(q,m){
		int a,b;cin >> a >> b;
		a--;b--;
		REP(i,n){
			if(i != a && i != b){
				ll tmp = (dp[i][a] + dp[i][b]) % MOD * inv % MOD;
				dp[i][a] = dp[i][b] = tmp;
				tmp = (dp[a][i] + dp[b][i]) % MOD * inv % MOD;
				dp[a][i] = dp[b][i] = tmp;
			}
		}
		ll tmp = (dp[a][b] + dp[b][a]) % MOD * inv % MOD;
		dp[a][b] = dp[b][a] = tmp;
	}
		
	ll ans = 0;
	REP(i,n)REP(j,i)ans = (ans + dp[i][j]) % MOD;
	REP(i,m)ans = (ans * 2) % MOD;
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;
// #define DEBUG
// #define TIME
/*
Learn : -
Problem Type : -
Source : -
*/
#pragma GCC optimize ("Ofast")
#define sint( a ) int a; qread(a);
#define sint2( a, b ) int a,b; qread(a),qread(b);
#define sint3( a, b, c ) int a,b,c; qread(a),qread(b),qread(c);
#define int1( a ) qread(a);
#define int2( a, b ) qread(a),qread(b);
#define int3( a, b, c ) qread(a),qread(b),qread(c);
#define mkp make_pair
#define mkt make_tuple
#define pb emplace_back
#define inf INT_MAX
#define all( x ) (x).begin(),(x).end()
#define F first
#define S second
#define sdouble( a ) double a; scanf("%lf",&a);
#define slong( a ) long long a; scanf("%lld",&a);
#define cstring( a, x ) char a[x]; scanf("%s",a);
#define sstring( a ) string a;cin>>a;
#define rev( s ) reverse(all(s));
#define FOR( a, b, c ) for(int a=b;a<c;a++)
#define ROF( a, b, c ) for(int a=b;a>c;a--)
#define pause system("pause")
#define endl printf("\n")
#define fastio {ios::sync_with_stdio(false);cin.tie(NULL);}
#define null NULL
#ifdef DEBUG
#define debug(x) cout<< #x << " = " << x;endl;
#else
#define debug( x )
#endif
#define OPEN freopen("input.txt","r",stdin)
#define SEND freopen("output.txt","w",stdout)
#ifdef COM
#define IN(x)
#define OUT(x)
#else
#define IN( x ) freopen(x,"r",stdin);
#define OUT( x ) freopen(x,"w",stdout);
#endif
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector <ii> vii;
typedef long long ll;

void qread( int &x )
{
	int neg = 1;
	x = 0;
	register char c = getchar();
	while(c < '0' || c > '9')
	{
		if(c == '-')neg = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9')x = 10 * x + c - '0', c = getchar();
	x *= neg;
}

void Wl( int x )
{
	printf("%d\n", x);
}

void Wl( double x )
{
	printf("%lf\n", x);
}

void Wl( string x )
{
	printf("%s\n", x.c_str());
}

void Wl( ll x )
{
	printf("%lld\n", x);
}

void W( int x )
{
	printf("%d ", x);
}

void W( double x )
{
	printf("%lf ", x);
}

void W( string x )
{
	printf("%s ", x.c_str());
}

void W( ll x )
{
	printf("%lld ", x);
}

int main()
{
    stack<char> st;
	sstring(s);
	string ans="";
	debug(s);
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='T')
		{
			if(!st.empty() && st.top()=='S')
			{
				st.pop();
			}
			else st.push('T');
		}
		if(s[i]=='S')
		{
			st.push('S');
		}
	}
	Wl((int)st.size());
}


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

using namespace std;

bool isPrime(int n){
	if(n < 2) return false;
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0) return false;
	}
	return true;
}

int main(){
	int n,p;
	while(cin >> n >> p,n!=-1){
		vector<int> primes;
		for(int i=n+1;primes.size()<=100;i++){
			if(isPrime(i)) primes.emplace_back(i);
		}
		vector<int> cc;
		for(int unsigned i = 0;i<primes.size();i++){
			for(int unsigned j = i;j<primes.size();j++){
				cc.emplace_back(primes[i]+primes[j]);
			}
		}
		sort(cc.begin(),cc.end());
		cout << cc[p-1] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3068
from collections import deque
h,w=map(int,input().split())
s=[ input() for _ in range(h)]
dist=[ [float('inf') for _ in range(w)] for _ in range(h)]
#print(s)
#do a bfs 
dq=deque()
dist[0][0]=0
dq.append([0,0])
white=0
for i in s:
    white+=i.count('.')
#print(white)
while len(dq)>0:
    xx,yy=dq.popleft()
    if xx==h-1 and yy==w-1:
        break
    for i,j in zip([-1,0,1,0], [0,1,0,-1]):
            x=xx+i
            y=yy+j
            def valid(x,y):
                if not(x>=0 and x<h and y>=0 and y<w) == True:
                    return False
                if s[x][y]=='.':
                    return True
                else:
                    return False
            if valid(x,y):
                if dist[x][y]>dist[xx][yy]+1:
                    dist[x][y]=1+dist[xx][yy]
                    dq.append([x,y])
#print(dist[h-1][w-1])
if dist[h-1][w-1]!=float('inf'):
    print(white-1-dist[h-1][w-1])
else:
    print(-1)





Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
const ll INF=1e9+7;
const ll N = 100002;
string s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>s;
	FOR(i,0,s.size()){
		if(s[i]==',')cout<<" ";
		else cout<<s[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e,k;
  cin >>a>>b>>c>>d>>e>>k;
  if(e-a>k){
    cout<<":("<<endl;
  }else{
    cout<<"Yay!"<<endl;
  }
  return 0;
}

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

bool isok(char a,char b){
  static string pata = "iw(){}[]";
  static string patb = "iw)(}{][";
  rep(i,pata.size()){
    if (pata[i] == a && patb[i] == b)return true;
  }
  return false;
}

main(){
  string in;
  while(cin>>in){
    int ans = 0;
    rep(i,(1<<in.size())){
      string tmp;
      rep(j,in.size())if ((1<<j)&i)tmp+=in[j];
      bool fg=false;
      if (tmp.size() < 3)goto end;
      rep(j,tmp.size()-2){
	if (tmp[j] == 'i' && tmp[j+1] == 'w' && tmp[j+2] == 'i')fg=true;
      }
      if (!fg)goto end;
      rep(j,tmp.size()/2){
	if (!isok(tmp[j],tmp[tmp.size()-1-j]))goto end;
      }
	ans=max(ans,(int)tmp.size());
      end:;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N, K; cin >> N >> K;
  int A[N]; rep(i, N) cin >> A[i];

  int result = ceil((double)(N-1)/(K-1));
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int N, M, a, b, C = 0;

std::vector<std::vector<int>> G;

bool visit[11];


void dfs(int i, int c)
{
  if (c == N) {
    C ++;
  }
  else {
    for (const auto& k : G[i])
      if (! visit[k]) {
        visit[k] = true;

        dfs(k, c + 1);
        
        visit[k] = false;
      }
  }
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::cin >> N >> M;

  G.resize(N);

  for (int i = 0; i < M; i ++) {
    std::cin >> a >> b;

    a --;
    b --;

    G[a].push_back(b);
    G[b].push_back(a);
  }

  visit[0] = true;

  dfs(0, 1);

  std::cout << C << std::endl;

  return 0;
}


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

struct{
	int link;
	int stg;
}typedef LinkStage;

class Vertex{
	private:
		int* links;
		int index;
		int num;
		bool arrived;
		int id;
		int d;
	public:
		Vertex(int u,int k):id(u), num(k),links(new int[k]),index(0),arrived(false),d(-1){}
		void addLink(int);
		void enQueueLinks(queue<LinkStage>*,int);	
		void print();
};

void Vertex::addLink(int link){
	links[index] = link - 1;
	index++;
}

void Vertex::enQueueLinks(queue<LinkStage>* taskQueue,int dist){
	if(arrived)
		return;

	for(int i = 0; i < index;i++){
		LinkStage stage;
		stage.link = links[i];
		stage.stg = dist + 1;
		taskQueue->push(stage);
	}
	arrived = true;
	d = dist;
}

void Vertex::print(){
	cout << id << " " << d << endl;
}

int main(){
	int n;
	cin >> n;
	Vertex** vertexes = new Vertex*[n];
	for(int i = 0;i < n;i++){
		int u;
		cin >> u;
		int k;
		cin >> k;
		Vertex* vertex = new Vertex(u,k);
		for(int j = 0;j < k;j++){
			int v;
			cin >> v;
			vertex->addLink(v);
		}
		vertexes[u - 1] = vertex;
	}
	queue<LinkStage> task;
	vertexes[0]->enQueueLinks(&task,0);
	while(!task.empty()){
		LinkStage curr = task.front();
		task.pop();
		int nextI = curr.link;
		int d = curr.stg;
		vertexes[nextI]->enQueueLinks(&task,d);
	}
	for(int i = 0; i < n;i++){
		vertexes[i]->print();
	
	}
	
	return 0;
}


Measured memory_bytes: 3128
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

ll l,r;
ll dp[61][2][2][2];

ll f(ll k,int flagX,int flagY, int flagZ){
    if (k==-1) {
        //cout << "unko" << endl;
        return 1;
    }
    if (dp[k][flagX][flagY][flagZ]!=-1) return dp[k][flagX][flagY][flagZ];
    ll m=(ll)1<<k;
    ll res=0;
    //cout << (l&m) << " " << (r&m) << endl;
    // x:1 y:1
    if (flagY || (r&m)!=0) {
        if ((l&m)==0) res+=f(k-1,1,flagY, 1);
        else res+=f(k-1,flagX,flagY, 1);
    }
    // x:0 y:1
    if ((flagX || ((l&m)==0)) && (flagY || ((r&m)!=0)) && flagZ) {
        res+=f(k-1,flagX,flagY,flagZ);
    }
    // x:0 y:0
    if (flagX || ((l&m)==0)) {
        if (((r&m)!=0)) res+=f(k-1,flagX,1, flagZ);
        else res+=f(k-1,flagX,flagY,flagZ);
    }
    res%=mod;
    dp[k][flagX][flagY][flagZ]=res;
    //cout << k << "," << flagX << "," << flagY << "," << flagZ << " " << dp[k][flagX][flagY][flagZ] << endl;
    return res;
}

void solve(){
    cin >> l >> r;
    rep(k,61){
        rep(flagX,2){
            rep(flagY,2){
                rep(flagZ,2) {
                    dp[k][flagX][flagY][flagZ]=-1;
                    //cout << k << "," << flagX << "," << flagY << "," << flagZ << " " << dp[k][flagX][flagY][flagZ] << endl;
                }
            }
        }
    }
    cout << f(60,0,0,0) << endl;
}

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

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

using namespace std;

int main(){

int N;
cin >> N;
long long A[N+2];

bool ans=true;
for(int i=1;i<=N;i++){
    cin >> A[i];
}
A[0]=A[N];
A[N+1]=A[1];
long long c=A[1];
for(int i=2;i<=N;i++){
    c=A[i]^c;
}
if(c==0){
    ans=true;
}
else{
    ans=false;
}
if(ans){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}

 return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,a,n)	for(int i=a;i<n;i++)
int main(){
	int x,y;
	cin>>x>>y;
	if(x%y==0||y==1){
		cout<<-1<<endl;
		return 0;
	}
	int i=1;
	while((x*i)%y==0){
		i++;
	}
	cout<<x*i<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define mp make_pair
#define pb push_back
#define INF (1<<29)
using namespace std;
typedef pair<int,int>pii;
int a=-1,c=-1;
string s;
void wa(){
	puts("WA");
	exit(0);
}
int main(){
	cin>>s;
	if(s.size()<4)wa();
	for(int i=0;i<s.size();i++){
		if(isupper(s[i])){
			if(s[i]=='A'){
				if(a==-1)a=i;
				else wa();
			}else if(s[i]=='C'){
				if(c==-1)c=i;
				else wa();
			}else wa();
		}
	}
	int cnt=0;
	for(int i=2;i<s.size()-1;i++)if(s[i]=='C')cnt++;
	if(a!=0)wa();
//	if(c!=2&&c!=s.size()-3)wa();
	if(cnt!=1)wa();
	puts("AC");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
 
int main () {
	int n,t,a1,a2,ans=0;

	cin >> n >> t >> a1;

	for(int i=0;i<n-1;i++){
		cin >> a2;
		ans += min(t,a2-a1);
		a1 = a2;
	}
	ans += t;


	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> v(n);
    rep(i, 0, n)
        cin >> v[i];
    sort(begin(v), end(v));
    vector<ll> dp(n);
    dp[0] = v[0];
    rep(i, 1, n)
        dp[i] = v[i] + dp[i-1];
    ll ans = 0;
    auto curr = begin(v);
    ll id;
    vector<pair<ll, ll>> w(m);
    rep(i, 0, m)
    {
        ll a, b;
        cin >> a >> b;
        w[i] = {b, a};
    }
    sort(rbegin(w), rend(w));
    rep(i, 0, m)
    {
        ll a = w[i].second;
        ll b = w[i].first;
        auto itr = lower_bound(curr, end(v), b);
        // if (itr == end(v))
        //     break;
        ll nb = distance(curr, itr);
        id = min(a, nb);
        curr = curr + id;
        if (id == 0)
            break;
        // cout << id << endl;
        ans += b * id;
        // cout << nb << endl;
        // cout << id << " -> " << dp[id-1] << endl;
        // cout << nb << " ";
        // ll res = b * id + dp[n-1] - dp[id-1];
        // ans = max(ans, res);
        // cout << nb << endl;
    }
    if (curr - begin(v) - 1 == -1)
        ans = dp[n-1];
    else 
        ans += dp[n-1] - dp[curr - begin(v) - 1];
    cout << ans;
    return 0;
}
// 10 3
// 30 30 30 30 7 8 13 33 52 100


Measured memory_bytes: 6288
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <sstream>
#include <string>
#include <utility>
#include <map>
#include <memory>
#include <set>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>

using namespace std;

class DisjointSet
{
public:
  int solve();
  int root( vector<int>& t, int id );
  int unite( vector<int>& t, int x, int y );
  int same( vector<int>& t, int x, int y );
};

int DisjointSet::root( vector<int>& t, int id )
{
  int p;
  p = t[id];
  while ( p != id )
    {
      id = p;
      p = t[id];
    }
  return p;
}

int DisjointSet::unite( vector<int>& t, int x, int y )
{
  int xp, yp;
  xp = root( t, x );
  yp = root( t, y );

  if ( xp != yp )
    t[xp] = yp;
  
  return 0;
}

int DisjointSet::same( vector<int>& t, int x, int y )
{
  if ( root( t, x ) == root( t, y ) )
    return 1;
  else
    return 0;
}

int DisjointSet::solve()
{
  int n, q;
  cin >> n >> q;

  vector<int> t( n );

  for ( auto i = 0; i < n; ++i )
    t[i] = i;

  for ( auto i = 0; i < q; ++i )
    {
      int com, x, y;
      cin >> com >> x >> y;

      if ( com == 0 )
        unite( t, x, y );
      else
        cout << same( t, x, y) << endl;
    }
  
  return 0;
}

int main()
{
  DisjointSet ds;

  ds.solve();

  return 0;
}

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

int main(){
	vector<char> S(4);
	for(int i = 0; i < 4; i++){
		cin >> S[i];
	}
	bool jdg = true;
	for(int i = 1; i < 4; i++){
		if(S[i - 1] == S[i]) jdg = false;
	}
	if(jdg) cout << "Good" << endl;
	else cout << "Bad" << endl;
}

Measured memory_bytes: 256
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    x,a,b = map(int, input().split())
    if abs(x-a)>abs(x-b):
        print('B')
    else:
        print('A')


if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val n: Int = io.StdIn.readInt()
    val children: Array[Seq[Int]] = Array.fill(n)(Seq(-1,-1))
    val parent: Array[Option[Int]] = Array.fill(n)(None)

    for {
      _ <- 0 until n
      l = io.StdIn.readLine()
    } {
      val Seq(i, c1, c2): Seq[Int] = l.split(" ", 3).map(_.toInt)
      children(i) = Seq(c1, c2)
      if (c1 != -1) parent(c1) = Some(i)
      if (c2 != -1) parent(c2) = Some(i)
    }

    def depth: Memoized[Int, Int] = Memoized {i =>
      parent(i) match {
        case None => 0
        case Some(x) => 1 + depth(x)
      }
    }
    def height: Memoized[Int, Int] = Memoized {i =>
      children(i) match {
        case Seq(-1, -1) => 0
        case Seq(x,  -1) => 1 + height(x)
        case Seq(-1,  y) => 1 + height(y)
        case Seq(x,   y) => 1 + (height(x) max height(y))
      }
    }

    for (i <- 0 until n) {
      val p: Int = parent(i).getOrElse(-1)
      val s: Int = if (p == -1) -1 else children(p).filterNot(_ == i).head
      val deg: Int = children(i).filterNot(_ == -1).length
      val t = if (p == -1) "root" else if (deg == 0) "leaf" else "internal node"

      println(s"node $i: parent = $p, sibling = $s, degree = $deg, depth = ${depth(i)}, height = ${height(i)}, $t")
    }
  }

  case class Memoized[Arg, Ret](f: Arg => Ret) extends (Arg => Ret) {
    val cache: mutable.Map[Arg, Ret] = mutable.Map[Arg, Ret]()
    def apply(arg: Arg): Ret = cache.getOrElseUpdate(arg, f(arg))
  }
}

Measured memory_bytes: 44516
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int id = 0;
string s;

int hhash(string p){
    int ret = -1;
    if(s[id] == '['){
        id++;
        switch(s[id++]){
        case '+':
            ret = hhash(p) | hhash(p);
            break;
        case '*':
            ret = hhash(p) & hhash(p);
            break;
        case '^':
            ret = hhash(p) ^ hhash(p);
            break;
        }
    }else{
        ret = p[s[id]-'a'] - '0';
    }
    id++;
    // cout << id << " " << ret << endl;
    return ret;
}

int main(){
    cin >> s;
    while(s != "."){
        string p;
        cin >> p;
        int ans = 0;
        id = 0;
        int enc = hhash(p);
        for(int i=0; i<10000; i++){
            string t = "";
            for(int j=1; j<10000; j*=10){
                t += (i/j)%10 + '0';
            }
            reverse(t.begin(), t.end());
            id = 0;
            if(hhash(t) == enc) ans++;
        }
        cout << enc << " " << ans << endl;
        cin >> s;
    }
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define INF 1<<30


int main(){
	int n;
	string s;
	cin >> n >> s;
	int A[10] = {0}, B[10][10] = {0}, C[10][10][10] = {0};
	queue<int> que;
	for(int i = 0; i < n; i++){
		int x = s[i] - '0';
		for(int j = 0; j < 10; j++){
			if(A[j]) que.push(j);
			for(int k = 0; k < 10; k++){
				if(B[j][k]) C[j][k][x] = 1;
			}
		}
		while(!que.empty()){
			int j = que.front();
			que.pop();
			B[j][x] = 1;
		}
		A[x] = 1;
	}
	int cnt = 0;
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			for(int k = 0; k < 10; k++){
				if(C[i][j][k]) cnt++;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
io = STDIN
n=io.gets.to_i
a=io.gets.split.map(&:to_i)
def div2cnt(x)
  cnt=0
  while (q,r=x.divmod(2);q>=1)
    break if r>0
    cnt+=1
    x=q
  end
  cnt
end
cnt=0
a.each do |i|
  cnt+=div2cnt(i)
end
puts cnt


Measured memory_bytes: 2428
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>
#include <iostream>

using namespace std;
int main() {
	int num[3][3];
	int count = 0;
	bool che[3][3] = { {false,false,false},
						{false,false,false},
						{false,false,false} };
	int n,tmp;
	vector <int> b;
	
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> num[i][j];
		}
	}
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				if (tmp == num[i][j]) {
					che[i][j] = true;
				}
			}
		}
	}

	for (int i = 0; i < 3; i++) {
		if (che[i][0] == true && che[i][1] == true && che[i][2] == true) {
			cout << "Yes";
			return 0;
		}
		if (che[0][i] && che[1][i] && che[2][i]) {
			cout << "Yes";
			return 0;
		}
		
	}
	if (che[0][0] == true && che[1][1] == true && che[2][2] == true) {
		cout << "Yes";
		return 0;
	}
	if (che[0][2] == true && che[1][1] == true && che[2][0] == true) {
		cout << "Yes";
		return 0;
	}
	cout << "No";

	return 0;

}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] A = nextIntArray(sc, N);

		sc.close();

		Arrays.sort(A);

		for (int i = 0; i < N - 1; i++) {
			if (A[i] == A[i + 1]) {
				out.println("NO");
				return;
			}
		}

		out.println("YES");

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}


Measured memory_bytes: 64324
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;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 INF 2e9
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    //COMinit();
    ll x;
    cin >> x;
    ll ans = 0;
    ll x1 = x/500;
    ans+=x1*1000;
    x=x-x1*500;
    x/=5;
    ans+=5*x;
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		for(int i = 0 ; i < s.length - 1 ; i++) {
			for(int j = i + 1 ; j < s.length ; j++) {
				if(s[i] > s[j]) {
					char w = s[i];
					s[i] = s[j];
					s[j] = w;
				}
			}
		}
		for(int i = 0 ; i < t.length - 1 ; i++) {
			for(int j = i + 1 ; j < t.length ; j++) {
				if(t[i] < t[j]) {
					char w = t[i];
					t[i] = t[j];
					t[j] = w;
				}
			}
		}
		if(new String(t).compareTo(new String(s)) > 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template <typename P, typename Q>
ostream& operator<<(ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T> v)
{
  os << "(";
  each (i, v)
    os << i << ",";
  os << ")";
  return os;
}

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

  string s, t;
  while (cin >> s >> t) {
    bool g = false;
    for (int i = 0; i < s.size(); ++i) {
      bool f = true;
      for (int j = 0; j < s.size(); ++j) {
        int k = (i + j) % s.size();
        f = f && (s[k] == t[j]);
      }
      g = g || f;
    }
    cout << (g ? "Yes" : "No") << endl;
  }

  return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  vector<int> T(N);
  for(int i = 0; i < N; ++i){
    cin >> S[i] >> T[i];
  }
  string X;
  cin >> X;
  bool f = false;
  int ans = 0;
  for(int i = 0; i < N; ++i){
    if(f) ans += T[i];
    if(S[i] == X) f = true;
  }
  cout << ans << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    ll x,y;
    int ans=1;
    cin >>x>>y;
    ll cnt=x;
    while(cnt <=y){
        cnt*=2;
        ans++;
    }
    cout<<ans-1<<endl;
}

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

int n;
vector<int> b;

int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x;
    cin >> x;
    b.push_back(x);
  }

  int prev, sum = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      sum += b[i];
      prev = b[i];
    } else if (i > b.size() - 1) {
      sum += prev;
    } else {
      sum += min(prev, b[i]);
      prev = b[i];
    }

  }

  cout << sum << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
ll n,d=1,nd,MOD=1e9+7;
int main(void){
    cin>>s;
    n=s.size();
    for(int i=0;i<n;i++){
        if(s[i]=='1'){
            nd=(3*nd+d)%MOD;
            d=(2*d)%MOD;
        }
        else nd=(3*nd)%MOD;
    }
    cout<<(d+nd)%MOD<<endl;
}


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

using namespace std;

const int N = 200;

int dp[N][N];

int grund(int u, int v) {
  if (u > v) swap(u, v);
  if (dp[u][v] != -1) return dp[u][v];
  int & ret = dp[u][v];
  set< int > st;
  for (int i = 2; i <= u; i += 2) {
    st.insert(grund(u-i, v + i/2));
  }
  for (int i = 2; i <= v; i += 2) {
    st.insert(grund(u+i/2, v - i));
  }
  ret = 0;
  for (int v : st)
    ret += ret == v;
  return ret;
}

int main() {
  // memset(dp, -1, sizeof dp);
  // for (int i = 0; i <= 100; i++) {
  //   for (int j = 0; j <= 100; j++) {
  //     // cerr << grund(i, j) << " ";
  //     if (abs(i-j) <= 1) {
  //       assert(grund(i, j) == 0);
  //       if (grund(i, j) == 0 && i <= j)
  //         cerr << i << " " << j << endl;
  //     }
  //     else
  //       assert(grund(i, j) > 0);
  //   }
  //   // cerr << endl;
  // }
  long long a, b;
  cin >> a >> b;
  if (abs(a-b) <= 1)
    puts("Brown");
  else
    puts("Alice");
  return 0;
}

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

typedef long long ll;
typedef long long int lli;
const int MOD = 1000000007;
#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

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

	int N,D; cin >> N >> D;

	int A = N,res=0;
	while (A > 0) {
		A = A - (2*D+1);
		res++;
	}
	cout << res << endl;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	ll n, k;
	set<ll> s;
	ll count = 0;
	ll ans = 0;
	
	cin >> n >> k;

	vector<ll> v(n, 0);

	REP(i, n) {
		ll a;
		cin >> a;
		v[a - 1]++;
		if (!s.count(a)) {
			s.insert(a);
			count++;
		}
	}

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

	ll now = 0;

	while (count > k) {
		if (v[now] != 0) {
			count--;
			ans += v[now];
		}
		now++;
	}

	cout << ans << endl;
}

Measured memory_bytes: 11136
#include <stdio.h>

int main(void){
    // 変数宣言
    long int n, a, b;
    long int total;

    // 入力
    scanf( "%ld %ld %ld", &n, &a, &b );

    // 演算
    if( n % ( a + b ) >= a ){
        total = a * ( n / ( a+b )) + a ;
    }else{
        total =  ( a * ( n / ( a+b ))) + (( n % ( a+b )) );
    }

    // 出力
    printf( "%ld", total );
    return 0;
}

Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
alice=0
bob=0
if n%2==0:
    while not len(a)==0:
        alice+=max(a)
        a.remove(max(a))
        bob+=max(a)
        a.remove(max(a))
    print(alice-bob)
else:
    while not len(a)==1:
        alice+=max(a)
        a.remove(max(a))
        bob+=max(a)
        a.remove(max(a))
    alice+=max(a)
    print(alice-bob)  

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

int main(void) {
	int r, D, x;
	
	scanf("%d %d %d", &r, &D, &x);
	for (int i = 1; i <= 10; i++) {
		x = x * r - D;
		printf("%d\n", x);
	}
	
	return 0;
}

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

typedef long long ll;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<string> vstring;
typedef vector<vector<string>> vvstring;

#define rep0(i, n) for(ll i=0; i<(ll)(n); i++)
#define rep1(i, n) for(ll i=1; i<=(ll)(n); i++)
#define rep(i, a, b) for(ll i=(ll)a; i<=(ll)(b); i++)
#define rep0r(i, n) for(ll i=(ll)(n)-1; i>=0; i--)
#define rep1r(i, n) for(ll i=(ll)(n); i>0; i--)
#define repr(i, a, b) for(ll i=(ll)b; i>=(ll)(a); i--)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) a * b / __gcd(a, b)
#define len(x) (ll)x.size()
#define Sort(x) sort(x.begin(), x.end())
#define rSort(x) sort(x.begin(), x.end(), greater<ll>())

const ll mod_const = 1000000007;
const double pi = acos(-1.0);

ll modpow(ll a, ll n, ll m) {
    ll result = 1;
    while(n > 0) {
        if(n&1) {
            result = result * a % m;
        }

    a = a * a % m;
    n >>= 1;
    }

    return result;
}

ll modinv(ll a, ll n) {
    if(a <= 1) {
        return 1;
    } else {
        return  n - modinv(n%a, n) * (n/a) % n;
    }
}

ll comb(ll n, ll r, ll m = mod_const) {
    vll fac = {1, 1};
    vll inv ={1, 1};
    vll facinv = {1 , 1};

    rep(i, 2, n) {
        fac.push_back(fac[i-1] * i % m);
        inv.push_back(modinv(i, m));
        facinv.push_back(facinv[i-1] * inv[i] % m);
    }

    if (n<r || n<0 || r<0) {
        return 0;
    } else {
        return fac[n] * (facinv[r] * facinv[n-r] % m) % m;
    }
}
void solve() {
    ll a, b;
    cin >> a >> b;
    cout << a*b << endl;
}

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

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

      Scanner sc = new Scanner(System.in);
		String text = sc.next();

		switch(text) {
		case "Sunny":
			System.out.println("Cloudy");
			break;
		case "Cloudy":
			System.out.println("Rainy");
			break;
		case "Rainy":
			System.out.println("Sunny");
			break;
		default:
			System.out.println("Error");
		}
	}
}


Measured memory_bytes: 19924
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

template<class S, class T>
void psort(vector<S> &u, vector<T> &v, bool isGreater = false) {
    int n = (int)u.size();
    vector<pair<S, T>> vecP(n);
    for (int i = 0; i < n; ++i) {
        vecP[i].first = u[i];
        vecP[i].second = v[i];
    }
    if (isGreater) {
        sort(vecP.rbegin(), vecP.rend());
    }
    else {
        sort(vecP.begin(), vecP.end());
    }
    for (int i = 0; i < n; ++i) {
        u[i] = vecP[i].first;
        v[i] = vecP[i].second;
    }
}

int N;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> N;
    vll X(N), Y(N);
    rep(i, N) {
        cin >> X[i] >> Y[i];
        // X[i]<=Y[i]とする
        if (X[i] > Y[i])swap(X[i], Y[i]);
    }
    /*
    最大値と最小値が同じ色になるかどうかで場合分けする
    とりあえず、最大値と最小値が異なる色になる場合について
    最大値を含む方は、大きい数を貪欲に
    最小値を含む方は、小さい数を貪欲に
    選ぶ。
    */
    ll rma = 0, rmi = INT_MAX, bma = 0, bmi = INT_MAX;
    rep(i, N) {
        smax(rma, X[i]);
        smin(rmi, X[i]);
        smax(bma, Y[i]);
        smin(bmi, Y[i]);
    }
    ll ans = (rma - rmi)*(bma - bmi);

    /*
    (X[i],Y[i])でソートする
    m, Mが同じ色に含まれる。
    (m, M)=(rmi, bma)
    他方の最小、最大は
    (z, Z)とする。
    zを昇順で見ていく。ただし、Zはできるだけ小さい方がいい。
    */
    psort(X, Y);
    int nm = 0, nM = 0;
    ll red = bma - rmi;
    // <値, id>
    set<pair<ll, int> > st, ts;
    rep(i, N) {
        st.insert(mp(X[i], i));
        ts.insert(mp(X[i], i));
        ts.insert(mp(Y[i], i));
        if (Y[i] == rmi)nm++;
        if (Y[i] == bma)nM++;
    }

    /*
    値aを取り除いてbを挿入
    */
    auto f = [&](ll a, ll b, int k) {
        if (X[k] != Y[k] && st.count(mp(a, k))) {
            st.erase(mp(a, k));
            st.insert(mp(b, k));
            if (a == rmi)nm++;
            if (a == bma)nM++;
            if (b == rmi)nm--;
            if (b == bma)nM--;
        }
    };

    [&] {
        each(p, ts) {
            /*
            zを最小値として固定
            */
            int k = p.second;
            ll z = p.first, w = X[k] ^ Y[k] ^ z;
            
            f(w, z, k);
            while (sz(st) && st.begin()->first < z) {
                ll u = st.begin()->first, v;
                int l = st.begin()->second;
                v = u ^ X[l] ^ Y[l];
                // すべての値をz以上にすることは不可能である。
                if (v < z) {
                    return;
                }
                f(u, v, l);
            }
            /*
            他方にm,Mが含まれている場合のみ計算
            */
            if (nm > 0 && nM > 0) {
                smin(ans, red*(st.rbegin()->first - st.begin()->first));
            }
        }
    }();
    cout << ans << endl;
}


Measured memory_bytes: 40904
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const long long INFL = 2e18;
const int MOD = 1000000007;
const int MAX_N = 500000;
int bit[MAX_N+1],n;
int sum(int i) {
	int s = 0;
	while(i > 0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}
void add(int i,int x){
	while(i <= n){
		bit[i] += x;
		i += i & -i;
	}
}
int main(){
	for(int i = 0;i <= MAX_N;i++)bit[i] = 0;
	int q;
	cin >> n >> q;

	vector<vector<int>> x(n+1);
	vector<vector<int>> a(n+1);
	map<int,int> bef_pos;
	for(int i = 0;i < n;i++){
		int c;
		cin >> c;
		if(bef_pos[c] == 0)bef_pos[c] = i + 1;
		else{
			x[bef_pos[c]].push_back(i+1);
			bef_pos[c] = i + 1;
		} 
	}

	for(int i = 0;i < n;i++){
		sort(x[i].begin(),x[i].end());
	}

	map<pair<int,int>,int> ans;
	vector<pair<int,int>> lr;
	for(int i = 0;i < q;i++){
		int l,r;
		cin >> l >> r;
		a[l].push_back(r);
		lr.push_back(make_pair(l,r));
	}


	for(int i = n;i >= 1;i--){
		for(int j = 0;j < x[i].size();j++){
			//cout << "add:" << i << " " << x[i][j] << endl;
			add(x[i][j],1);
		}
		for(int j = 0;j < a[i].size();j++){
			//cout << i << " " << a[i][j] << endl;
			//cout << "sum:" << a[i][j] << "->" << sum(a[i][j]) << endl;;
			ans[make_pair(i,a[i][j])] = a[i][j] - i + 1 - sum(a[i][j]);
		}
	}
	for(int i = 0;i < q;i++){
		cout << ans[lr[i]] << endl;
	}
}


Measured memory_bytes: 96828
import sys
readline = sys.stdin.readline
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    N = int(readline())
    start = 1
    cnt = 1
    while True:
        last = start * 26
        if start <= N <= last:
            break
        start = last + 1
        cnt += 1
    
    idx = N - start  # その文字数の中で何番目か (0番目スタート)

    res = ""
    while cnt:
        chara = idx // 26 ** (cnt - 1)
        idx -= 26 ** (cnt - 1) * chara
        chara = alp[chara]
        res += chara
        cnt -= 1
    
    print(res)


if __name__ == '__main__':
    main()

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

typedef long long int lli;
#define rep(i, a, b) for(lli i  = (lli)(a); i < (lli)(b);i++)
#define REP(i,n) for(lli(i)=0;(i)<(lli)(n);(i)++)
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define sz(v) (v).size()
#define all(v) (v).begin(), (v).end()
#define trace(x) cerr << #x << ": " << x << endl;


typedef pair<lli, lli> ii;
typedef pair<ii, lli> iii;
typedef vector<lli> vi;
typedef vector<ii> vii;
typedef long double C;
typedef complex<C> P;
#define X real()
#define Y imag()
C EPS=1e-9;
C pi=acos(-1.0);
const int N=1e5+200;
const int INF=1100000;

int main(){
	fastio;
	lli dp[N];
	vector<lli> h;
	lli n,k; cin>>n>>k;
	rep(i,0,n) dp[i]=INF;
	REP(i,n){
		lli num; cin>>num;
		h.pb(num);
	}
	
	dp[0]=0;
	dp[1]=abs(h[0]-h[1]);
	rep(i,2,n){
		lli minicost=dp[i-1]+abs(h[i]-h[i-1]);
		for(int j=2;j<=k && j<=i;j++){
			if(minicost>dp[i-j]+abs(h[i-j]-h[i])) minicost=dp[i-j]+abs(h[i-j]-h[i]);
			//minicost=min(minicost,dp[i-j]+abs(v[i]-v[i+j]));
		}
		dp[i]=minicost;
	}

	cout<<dp[n-1];


	return 0;
}

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

public class Main {
    public static void main(String... args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        int[] A = new int[N];
        String[] strA = reader.readLine().split(" ");
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(strA[i]);
        }
        int[] leftGcd = new int[N - 1];
        leftGcd[0] = A[0];
        for (int i = 0; i < N - 2; i++) {
            leftGcd[i + 1] = gcd(leftGcd[i], A[i + 1]);
        }
        int[] rightGcd = new int[N - 1];
        rightGcd[N - 2] = A[N - 1];
        for (int i = N - 3; 0 <= i; i--) {
            rightGcd[i] = gcd(A[i + 1], rightGcd[i + 1]);
        }
        int[] allGcd = new int[N];
        allGcd[0] = rightGcd[0];
        for (int i = 0; i < N - 2; i++) {
            allGcd[i + 1] = gcd(leftGcd[i], rightGcd[i + 1]);
        }
        allGcd[N - 1] = leftGcd[N - 2];
        int max = 0;
        for (int cur : allGcd) {
            if (max < cur) {
                max = cur;
            }
        }
        System.out.println(max);
    }

    private static int gcd(int a, int b) {
        int r = a % b;
        return (r == 0) ? b : gcd(b, r);
    }
}


Measured memory_bytes: 43532
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A,B,C,K,ans=0;
  cin >> A >> B >> C >> K;
 
    if(K <= A){
        cout << K << endl;
    }
    else if(K <= A+B){
        cout << A << endl;
    }
    else{
        cout << A - (K-A-B) << endl;
    }
}

Measured memory_bytes: 3592