akhauriyash/Code-Regression huggingface dataset:
/*input
8
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
#define PI 3.14159265
#define endl '\n'
#define debug(x) cout << #x << " = " << x << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
    int x = 1 % mod;
    while(b){
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin >> n;
  ll ans = 0;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ll a = i - 1;
      if (a > 0) ans += a * (n / a == n % a);
      if (n / i != i) {
        a = n / i - 1;
        if (a > 0) ans += a * (n / a == n % a);
      }
    }
  }
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <queue>

using namespace std;

int main()
{
    bool flagflag=true;
    int N,M;
    while(cin>>N>>M){
        if(N==0&&M==0)break;
        
        int r;
        cin>>r;
        int data[1000][4];
        for(int i=0; i<r; i++){
            int tt,nn,mm,ss;
            cin>>tt>>nn>>mm>>ss;
            data[i][0]=tt;
            data[i][1]=nn;
            data[i][2]=mm;
            data[i][3]=ss;
            
        }
        
        int q;
        cin>>q;
        for(int roop=0; roop<q; roop++){
            int ts,te,mm;
            cin>>ts>>te>>mm;
            int start=ts;
            int ret=0;
            bool in_flag=false;
            
            queue<int> qu;
            
            for(int i=0; i<r; i++){
                if(data[i][0]>te)break;
                if(data[i][2]==mm){//dataが対象人物
                    in_flag=true;
                    if(data[i][3]==1){//ログインなら
                        if(qu.empty()){
                            start=data[i][0];
                            if(start<ts)start=ts;
                            

                        }
                        qu.push(data[i][1]);
                    }else{//ログアウトなら
                        int qusize=(int)qu.size();
                        for(int j=0; j<qusize; j++){
                            int pc = qu.front();
                            qu.pop();
                            if(pc==data[i][1])break;
                            else qu.push(pc);
                        }
                        int end = data[i][0];
                        if(qu.empty()){
                            if(end>te)end=te;
                            if(start<end)ret+=end-start;
                        }
                    }

                }
            }
            
            if(!qu.empty()){
                if(start<te)ret+=te-start;
            }
            
            
            if(in_flag)cout<<ret<<endl;
            else cout<<0<<endl;
            
        }
    }
    
    return 0;
}

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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int N;
    string s;
    cin >> N >> s;
    int r_cnt = 0, w_cnt = 0;
    REP(i, 0, N){
        if(s[i] == 'R') r_cnt++;
        if(s[i] == 'W') w_cnt++;
    }
    int ans = 0;
    REP(i, 0, r_cnt){
        if(s[i] == 'W') ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3748
#include<iostream>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
ll n,m,p[100010],x[100010],y[100010],ans;
ll par[100010],ranki[100010];


int find(int x){
  if(par[x]==x) return x;
  else return par[x]=find(par[x]);
}

void unit(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(ranki[x]<ranki[y]) par[x]=y;
  else par[y]=x;
  if(ranki[x]==ranki[y]) ranki[x]++;
}

bool same(int x,int y){
  return find(x)==find(y);
}

int main(){
  cin>>n>>m;
  fr(i,n){
    par[i]=i;
    ranki[i]=0;
  }
  fr(i,n) cin>>p[i];
  fr(i,m) cin>>x[i]>>y[i];
  fr(i,m) unit(x[i]-1,y[i]-1);
  ans=0;
  fr(i,n){
    if(p[i]-1==i) ans++;
    else if(same(p[i]-1,i)) ans++;
  }
  cout<<ans;
}

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

using namespace std;
const int INF = INT_MAX;
const int MOD = 1000000007;

bool cmp(pair<int, int> a, int b){
    return a.second < b;
}

int main() {
    ios::sync_with_stdio(false);
    long long a, b, k;
    cin >> a >> b >> k;
    if (k <= a){
        cout << a - k << ' ' << b;
    }
    else {
        cout << "0 " << max(0ll, b - k + a);
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4

int main(){
  int N,M; cin >> N >> M;
  int p[M];
  string S[M];
  rep(i,M) cin >> p[i] >> S[i];

  int cnt = 0, penalty = 0;
  int WA[N]={}, AC[N]={};
  rep(i,M){
    if (S[i]=="WA") WA[p[i]-1]++;
    else if (S[i]=="AC" && AC[p[i]-1]==0){
      AC[p[i]-1]++;
      cnt++;
      penalty += WA[p[i]-1];
    }
  }

  cout << cnt << " " << penalty << endl;



  return 0;
}

Measured memory_bytes: 6912
h, w = map(int, input().split())
board = [str(input()) for i in range(h)]

for i in range(h-1):
    for j in range(w-1):
        if board[i][j+1] == "#" and board[i+1][j] == "#":
            print("Impossible")
            exit()
        
print("Possible")

Measured memory_bytes: 3060
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,m,a[100100];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	ll ans=0;
	n=read();m=read();
	rep(i,1,n)
	{
		a[i]=read();
		if (i==1) continue;
		if (a[i]+a[i-1]>m)
		{
			int dec=a[i]+a[i-1]-m;ans+=dec;
			if (a[i]>=dec) a[i]-=dec;else a[i]=0;
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 640
s=input()
k=int(input())
s1=list(s)
s2=[s[i:i+2] for i in range(len(s)-1)]
s3=[s[i:i+3] for i in range(len(s)-2)]
s4=[s[i:i+4] for i in range(len(s)-3)]
s5=[s[i:i+5] for i in range(len(s)-4)]
sall=sorted(list(set(s1+s2+s3+s4+s5)))
print(sall[k-1])

Measured memory_bytes: 5140
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("in.in");ofstream coutt("out.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

int n,m;
int ans;
vi v,pre;

bool f(int sum){//min sum of 2 pair from m
    int cnt=0;
    int lo=0;
    for(int i=0;i<n;i++){
        //v[i]+x>=sum
        //x>=sum-v[i]
        int num=v.end()-lower_bound(all(v),sum-v[i]);
        cnt+=num;
        lo+=num*v[i]+pre[n-1]-(n-num-1>=0?pre[n-num-1]:0);
    }
    if(cnt>=m){
        ans=lo-(cnt-m)*sum;
        return 1;
    }
    return 0;
}

signed main(){
    FASTER;
    cin>>n>>m;
    v=vi(n);cin>>v;
    sort(all(v));
    pre=v;
    for(int i=1;i<n;i++)pre[i]+=pre[i-1];
    
    int s=2*v[0],e=2*v[n-1];
    while(s<=e){
        int mid=(s+e)/2;
        if(f(mid))s=mid+1;
        else e=mid-1;
    }
    cout<<ans;
}


Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
vector<ll> okay(100005,-1);
vector <ll> arr;
ll ans(ll x)
{

	if(okay[x-1]!=-1)
	{
		return okay[x-1];
	}
	if(x<=3)
    {
        return okay[x-1];
    }
	if(x>3)
	{
	    //cout
       
		okay[x-1]=min(abs(arr[x-1]-arr[x-2])+ans(x-1),abs(arr[x-1]-arr[x-3])+ans(x-2));
	}
	// cout<<x<<" "<<okay[x-1]<<endl;
	return okay[x-1];
}
int main()
{
	ios_base::sync_with_stdio(false);
	
	cin.tie(NULL);
	ll n;
	cin>>n;

	for(ll i=0;i<n;i++)
	{
		ll temp;
		cin>>temp;
		arr.pb(temp);
	}
	okay[1]=abs(arr[1]-arr[0]);
	if(n==2)
	{
		cout<<okay[1];
		return 0;
	}
	else
	{
		okay[2]=min(abs(arr[2]-arr[0]),abs(arr[2]-arr[1])+okay[1]);
	}
	cout<<ans(n);
	//cout<<okay[n-1];
	return 0;
}


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

int main(){
  int N;
  cin >> N;  
  int A[N+1];
  
  for( int i = 1; i < N+1; i++){
    int order;
    cin >> order;
      A[order] = i;
  }
  for( int i = 1; i < N+1; i++){
    cout << A[i] << ' ';
  }
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
using namespace std;
int main(void){
    long int X, goh, go, ans;
    cin >> X;
    goh = X / 500;
    go = (X-(goh*500) )/ 5;
    ans = goh*1000 + go*5;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
int n;
string s;
int a[26];
vector<int>v;
long long dp[26];
int main()
{
    cin>>n>>s;
    for(int i=0;i<n;i++)
        a[s[i]-'a']++;
    for(int i=0;i<26;i++)
        if(a[i])
        v.push_back(a[i]);
    for(int i=0;i<v.size();i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(j==0)
                dp[j]=(dp[j]+v[i])%mod;
            else
                dp[j]=(dp[j]+dp[j-1]*v[i])%mod;
        }
    }
    long long ans=0;
    for(int i=0;i<26;i++)
        ans=(ans+dp[i])%mod;
    cout<<ans<<endl;
}


Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(2 * M);
  
  for(int i = 0; i < 2 * M; i++){
    cin >> vec[i];
  }
  
  int sum;
  
  for(int i = 0; i < N; i++){
    sum = 0;
    for(int j = 0; j < 2 * M; j++){
      if(vec[j] == i + 1 ){
        sum++;
      }
    }
    cout << sum << endl;
  }
  
  return 0;
}

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

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

    int a[n+1];
    a[0]=0;

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

    int dp[n+1][2]={};


    dp[1][0]=a[1];
    dp[1][1]=a[1];


    dp[2][0]=a[1]+a[2];
    dp[2][1]=-a[1]-a[2];

    for(int i=3;i<=n;i++)
    {
        dp[i][0]=max(dp[i-1][0]+a[i],dp[i-1][1]+a[i]);
        dp[i][1]=max(dp[i-1][0]-a[i]-2*a[i-1],dp[i-1][1]+2*a[i-1]-a[i]);
    }

    cout<<max(dp[n][0],dp[n][1]);
}

Measured memory_bytes: 2560
<?php
fscanf(STDIN, "%d", $count);
$list = ['AC' => 0, 'WA' => 0, 'TLE' => 0, 'RE' => 0];
for ($i = 0; $i < $count; $i++) {
  fscanf(STDIN, "%s", $a);
  $list[$a]++;
}

foreach($list as $key => $count) {
echo $key . ' x ' .$count."\n";
}

Measured memory_bytes: 16052
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0;i < n;i++)
using namespace std;
typedef long long ll;
 
int main() {
  int x, a; cin >> x >> a;
  if(x >= a){
    cout << 10 << endl; 
  }else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
# coding: utf-8
import sys
input = sys.stdin.readline

N = int(input())
D, X = map(int, input().split())
lst_day = [day for day in range(1, D+1)]

eaten_choco = 0
for _ in range(N):
    Ai = int(input())
    eaten_one_person = len(lst_day[::Ai])
    eaten_choco += eaten_one_person
print(eaten_choco + X)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;

 
int main(void){
    int n;
    cin>>n;
    vector<int>p(n);
    for(int i=0;i<n;i++)cin>>p[i];
    int ans =1;
    int mi=p[0];
    for(int i=1;i<n;i++){
        if(p[i]<mi){
            ans++;
            mi=p[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int i, j;
  int n, m, d;
  int a[10];
  int p[10];
  int r[10];

  scanf("%d%d%d", &n, &m, &d);

  for(i = 0; i < m; i++)
    scanf("%d", a + i);

  for(i = 0; i < m; i++)
    p[i] = a[i] * 100;


  for(i = 0; i < d; i++){
    for(j = 0; j < m; j++)
      scanf("%d", r + j);

    for(j = 0; j < m; j++)
      if(r[j] != -1)
	r[j] = (n % a[j] + a[j] - r[j]) % a[j];

    while(n >= 0){
      int ok = 1;
      int mx = 0;

      for(j = 0; j < m; j++)
	if(r[j] > 0){ ok = 0; break; }

      if(ok) break;

      for(j = 0; j < m; j++)
	if(r[j] > mx) mx = r[j];

      for(j = 0; j < m; j++)
	if(r[j] >= 0){
	  r[j] = (r[j] + p[j] - mx) % a[j];
	}

      n -= mx;
    }
  }

  if(n < 0) puts("-1");
  else printf("%d\n", n);

  return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#define ll long long
using namespace std;
ll n,a[101];
int i;
ll f(ll n)
{
    if(a[n])
    {
        return a[n];
    }
    if(n>0)
    {
        a[n]=f(n-1)*2+2;
    }
}
int main()
{
    scanf("%d",&n);
    a[0]=2;
    f(n);
    printf("%lld\n",a[n]);
}

Measured memory_bytes: 128
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 

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



int n, arr[100005], DP[100005], maxright[2][100005];



int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

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

    maxright[0][n] = maxright[1][n] = n;
    DP[n] = 1;
    for(int i=n-1;i>=1;i--){
        if(arr[i] == arr[i+1]){
            maxright[0][i] = maxright[0][i+1];
            maxright[1][i] = maxright[1][i+1];
        }
        else if(arr[i] < arr[i+1]){
            maxright[0][i] = maxright[0][i+1];
            maxright[1][i] = i;
        }
        else if(arr[i] > arr[i+1]){
            maxright[0][i] = i;
            maxright[1][i] = maxright[1][i+1];
        }
        DP[i] = 1+min(DP[maxright[0][i]+1], DP[maxright[1][i]+1]);
    }

    cout<<DP[1];
    return 0;
}





Measured memory_bytes: 1792
using System;

class C
{
	static void Main()
	{
		var h = Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
		double x = h[0], k = h[1], s = 0, p = 1, c;

		while (x > 0)
		{
			x -= c = Math.Max(Math.Floor(x - k / p + 1), 0);
			s += c / p;
			p *= 2;
		}
		Console.WriteLine(s / h[0]);
	}
}


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

typedef pair<long long, long long> P;
int p[10];

void solve(int a, int l){
	int t = 0;
	vector<P> w;
	w.push_back(P(a, t));
	++t;
	while(1){
		vector<int> v;
		int tmp = a;
		for(int i=0; i<l; ++i){
			v.push_back(tmp % 10);
			tmp /= 10;
		}
		sort(v.begin(), v.end());
		int ma = 0, mi = 0;
		for(int i=0; i<l; ++i){
			ma += v[i] * p[i];
			mi += v[i] * p[l-i-1];
		}
		a = ma - mi;
		for(int i=0; i<w.size(); ++i){
			if(w[i].first == a){
				cout << i << " " << a << " " << t-i << "\n";
				return;
			}
		}
		w.push_back(P(a, t));
		++t;
	}
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	p[0] = 1;
	for(int i=1; i<10; ++i)
		p[i] = p[i-1] * 10;
	while(1){
		int a, l;
		cin >> a >> l;
		if(a == 0 && l == 0) return 0;
		solve(a, l);
	}
}


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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

signed main() {
    int n, k;
    string ss;
    cin >> n >> ss >> k;
    char s = ss[k-1];
    rep(i, n) {
        if(ss[i] != s) ss[i] = '*';
    }
    cout << ss << nl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] n = new int[4];
		for(int i = 0;i < 4;i ++) {
			int N = sc.nextInt();
			if(N == 1) n[0]++;
			else if(N == 9) n[1]++;
			else if(N == 7) n[2]++;
			else if(N == 4) n[3]++;
		}
		if(n[0] == 1 && n[1] == 1 && n[2] == 1 && n[3] == 1) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 23124
#include <assert.h>
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;

int isPrime[N]; 
int Prime[N];
int primeTot;
ll Mul[N];

vector<pair<int, int> > vc;


ll Pow(ll x, ll y) {
    ll ans = 1;
    while(y) {
        if(y & 1) ans = 1ll * ans * x % MOD;
        x = 1ll * x * x % MOD;
        y >>= 1;
    }
    return ans;
}

ll C(int x, int y) {
    if(y == 0) return 1;
    return 1ll* Mul[x] * Pow(Mul[y] * Mul[x - y] % MOD, MOD - 2) % MOD;
}

int main() {
    int n, m;
    primeTot = 0;
    Mul[1] = 1; Mul[0] = 1;
    for(int i = 2; i < N; ++i) {
        Mul[i] = 1ll* Mul[i-1] * i % MOD;
    }
    for(int i = 2; i < N; ++i) {
        if(!isPrime[i]) {
            Prime[++primeTot] = i;
        }
        for(int j = 2*i; j < N; j += i) {
            isPrime[j] = 1;
        }
    }


    while(~scanf("%d %d", &n, &m)) {
        int M = m;
        vc.clear();

        for(int i = 1; i <= primeTot; ++i) {
            if(M % Prime[i] == 0) {
                int cnt = 0;
                while(M % Prime[i] == 0) {
                    M /= Prime[i];
                    cnt ++;
                }
                vc.emplace_back(Prime[i], cnt);
            }
            if(1ll*Prime[i]*Prime[i] > M) break;
        }
        if(M != 1) {
            vc.emplace_back(M, 1);
        }

        ll ans = 1;
        for(int i = 0; i < (int)vc.size(); ++i) {
            ans = (ans * C(n + vc[i].second - 1, n - 1)) % MOD;
        }

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

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

const int A = 0, G = 1, C = 2, T = 3;
const int base = 4;
int dp[110][base][base][base];

int main(){
	for( int e = A; e < base; ++e ){
		for( int z = A; z < base; ++z ){
			for( int d = A; d < base; ++d ){
				dp[0][e][z][d] = 1; 
			}
		}	
	}
	dp[0][A][G][C] = 0;
	dp[0][A][C][G] = 0;
	dp[0][G][A][C] = 0;
	int n; cin >> n;
	n -= 3;
	for( int i = 0; i < n; ++i ){
		for( int e = A; e < base; ++e ){
			for( int z = A; z < base; ++z ){
				for( int d = A; d < base; ++d ){
					for( int a = A; a < base; ++a ){
						if( !(
							( z == A && d == G && a == C )							
							||
							( z == A && d == C && a == G )
							||
							( z == G && d == A && a == C )		
							||
							( e == A && z == G && a == C )		
							||
							( e == A && d == G && a == C )
						) ){
							dp[i+1][z][d][a] += dp[i][e][z][d];
							dp[i+1][z][d][a] %= mod;
						}
					}
				}
			}	
		}
	}
	int ans = 0;
	for( int e = A; e < base; ++e ){
		for( int z = A; z < base; ++z ){
			for( int d = A; d < base; ++d ){
				ans += dp[n][e][z][d];
				ans %= mod;
			}
		}	
	}
	cout << ans << endl;
}

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

int main() {
	int a;
	char b;
	string c;
	int d[4] = { 0 };
	while (cin >> a >> b) {
		cin >> c;
		if (c == "A"){
			d[0] += 1;
		}
		else if (c == "B"){
			d[1] += 1;
		}
		else if (c == "AB"){
			d[2] += 1;
		}
		else if (c == "O")
		{
			d[3] += 1;
		}
	}
	cout << d[0] << endl << d[1] << endl << d[2] << endl << d[3] << endl;
}

Measured memory_bytes: 3156
import sys
input = sys.stdin.readline

def main():
	#N = int(input())
	#S = input().rstrip()
	Q,H,S,D = map(int,input().split())
	N = int(input())
	
	H = min(H, 2*Q)
	S = min(S, 2*H)
	D = min(D, 2*S)
	res = D*(N//2) + S*(N%2)
	
	print(res)
	
main()


Measured memory_bytes: 3064
import numpy as np
h, w, k = map(int, input().split())
_map = np.zeros((h, w), dtype = int)
ans = 0

def Count(k, s):
  _array = np.copy(_map)
  for j in range(s):
    if ((k >> j) & 1):
      if j < h:
        _array[j, :] = 0
      else:
        _array[:, j - h] = 0
        
  return np.sum(_array) == k

for i in range(h):
  _str = list(input())
  for j in range(w):
    if (_str[j] == "#"):
      _map[i, j] = 1
      
for i in range(2**(h + w)):
  _array = np.copy(_map)
  for j in range(h + w):
    if ((i >> j) & 1):
      if j < h:
        _array[j, :] = 0
      else:
        _array[:, j - h] = 0
        
  if np.sum(_array) == k:
    ans += 1
print(ans)

Measured memory_bytes: 26832
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    
    int num1=0,num0=0;
    for (int i=0; i < s.size(); ++i)
    {
        if (s[i] == '0') ++num0;
        else ++num1;
    }
    
    
    cout << min(num0,num1) * 2 << endl;
    
    return 0;
}

Measured memory_bytes: 512
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
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; }
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
int n, m;
vector<p> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (ll i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(make_pair(temp,i));
    }
    sort(ALL(a));
    ll ans = 0;
    for(int i=0;i<n;i++){
        if(abs(i-a[i].second)%2){
            ans++;
        }
    }
    cout << ans/2 << "\n";
}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define INF 10**9

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n,int k){
      return fact[n]*ifact[n-k];
  }
} c(1000005);

int main() {
    int n,m;
    cin >> n >> m;
    mint ans = 0;
    rep(i,n+1){
        mint now = c(n,i);
        now *= c.p(m-i,n-i);
        if (i&1){
            now *= -1;
        }
        ans += now;
    }
    ans *= c.p(m,n);
    cout << ans << endl;
}

Measured memory_bytes: 18624
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let s: Vec<char> = it.next().unwrap().chars().collect();
    let t: Vec<char> = it.next().unwrap().chars().collect();
    let h = s.len();
    let w = t.len();
    let mut dp = vec![vec![0u16; w + 1]; h + 1];
    for i in (0..h).rev() {
        for j in (0..w).rev() {
            if s[i] == t[j] {
                dp[i][j] = dp[i + 1][j + 1] + 1;
            } else {
                dp[i][j] = std::cmp::max(dp[i + 1][j], dp[i][j + 1]);
            }
        }
    }
    let mut ans = String::new();
    let mut x = 0;
    let mut y = 0;
    while dp[x][y] > 0 {
        if s[x] == t[y] {
            ans.push(s[x]);
            x += 1;
            y += 1;
        } else if dp[x][y] == dp[x + 1][y] {
            x += 1;
        } else {
            y += 1;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 22780
#include <bits/stdc++.h>
#include <unistd.h>
#include <random>

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      string s;
      cin >> s;
      int ans = 0;
      int once = 0;
      for(int i = 0;i < s.size();i++){
      	if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
      		once++;
      	}
      	else{
      		ans = max(ans,once);
      		once = 0;
      	}
      }
      cout << max(once,ans) << endl;
}

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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e16;
const int MOD = 1e9 + 7;
const int MB = 20;

void solve() {
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0, j = s.size() - 1; i < j; i++, j--) {
		if (s[i] != s[j]) ans++;
	}
	cout << ans;
}

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int k = sc.nextInt();
    int res;
    if (a + b >= k) {
      if (a >= k) {
        res = k;
      } else {
        res = a;
      }
    } else {
      res = 2*a+b-k;
    }
    System.out.println(res);
    sc.close();
  }
}

Measured memory_bytes: 35760
#include <iostream>

using namespace std;

int main()
{
   int i, h, m, s;
   cin >> i ; 
   h = i/3600 ;
   m = i/60 - h*60 ;
   s = i % 60 ;
   cout << h << ":" << m << ":" << s << endl; 
   
   return 0;
}


Measured memory_bytes: 3108
function Main(input) {
	var idata = input.split(/\s|\n/);
	var ndata = [];
	var datasuu = parseInt(idata[0]);
	for(k=1;k<idata.length;k++){
		ndata.push(parseInt(idata[k]));
	}
	//右から順番に比較していって、もし左＞右なら左を一個下げる
	for(i=1;i<datasuu;i++){
		if(ndata[datasuu-i-1]>ndata[datasuu-i]){
			ndata[datasuu-i-1]-=1;
		}
	}
	//新しいものが本当に改善しているか確かめる
	for(j=1;j<datasuu;j++){
		if(ndata[j-1]>ndata[j]){
			return console.log("No");
		}
	}
	return console.log("Yes");
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 26816
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(nk[1] == 1 ? 0 : nk[0] - nk[1]);
    }
}


Measured memory_bytes: 13268
import Control.Monad
import Text.Printf

main = do
  line <- fmap (fmap (read :: String -> Double) . words) getLine
  let aa = Point { x = line !! 0, y = line !! 1}
  let bb = Point { x = line !! 2, y = line !! 3}
  let l = Line aa bb
  q <- readLn
  input <- replicateM q getLine
  let xs = fmap (fmap (read :: String -> Double) . words) input
  let result = fmap (\e -> (x $ res l (e !! 0) (e !! 1), y $ res l (e !! 0) (e !! 1))) xs
  mapM_  (\r -> (printf "%.8f %.8f\n" (fst r) (snd r))) result
    where res l x1 y1 = Point{x=x1,y=y1} `project` l

eps :: (Floating a) => a
eps = 1e-7

add :: (Ord a, Floating a) => a -> a -> a
add a b -- = a + b
  | abs (a + b) < eps * (abs a + abs b ) = 0.0
  | otherwise = a + b

data Point a = Point { x :: a, y :: a } deriving (Eq)
data Line a = Line {a :: Point a, b :: Point a}

(^+) :: (Ord a, Floating a) => Point a -> Point a -> Point a
a ^+ b =  Point (add (x a) (x b)) (add (y a) (y b))

(^-) :: (Ord a, Floating a) => Point a -> Point a -> Point a
a ^- b = Point (add (x a) (-x b)) (add (y a) (-y b))

(^*) :: (Floating a) => Point a -> a -> Point a
a ^* d = Point (x a * d) (y a * d)

dot :: (Floating a) => Point a -> Point a -> a
a `dot` b = x a * x b + y a * y b

project :: (Ord a, Floating a) => Point a -> Line a -> Point a
p `project` l = a l ^+ (base ^* t)
  where base = b l ^- a l
        t = ((p ^- a l) `dot` base) / (base `dot` base)

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

class SegmentTree{
    int N;
    vector<ll> dat;
    
    ll query_impl(int a,int b,int k,int l,int r){
        if(a<=l && r<=b) return dat[k];
        if(r<=a || b<=l) return 0;
        int mid=(l+r)/2;
        ll c1v=query_impl(a,b,k*2+1,l,mid);
        ll c2v=query_impl(a,b,k*2+2,mid,r);
        return max(c1v,c2v);
    }
    public:
    SegmentTree(int n){
        N=1;
        while(N<n) N*=2;
        dat.assign(2*N-1,0);
    }

    void update(int pos,ll val){
        pos+=N-1;
        dat[pos]=val;
        while(pos>0){
            int par=(pos-1)/2;
            int c1=par*2+1;
            int c2=par*2+2;
            dat[par]=max(dat[c1],dat[c2]);
            pos=par;
        }
    }

    ll query(int a,int b){
        return query_impl(a,b,0,0,N);
    }

};
int main(){
    ll n;
    cin>>n;
    vector<int> revx(n);
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        revx[x-1]=i;
    }
    SegmentTree seg(n);
    for(int i=0;i<n;i++){
        ll sc=seg.query(0,revx[i])+i+1;
        seg.update(revx[i],sc);
    }
    cout<<n*(n+1)/2-seg.query(0,n)<<endl;
    return 0;
}


Measured memory_bytes: 5244
N = int(raw_input())
A, B = map(int, raw_input().split())
P = map(int, raw_input().split())

one = [p for p in P if p <= A]
two = [p for p in P if A < p and p <= B]
three = [p for p in P if B < p]

print(min(len(one), len(two), len(three)))


Measured memory_bytes: 2568
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a<=b){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
        
   }
}


Measured memory_bytes: 35728
#include <bits/stdc++.h>
using namespace std;
int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    for(int i=0;i<tx-sx;i++) cout<<'R';
    for(int i=0;i<ty-sy;i++) cout<<'U';
    for(int i=0;i<tx-sx;i++) cout<<'L';
    for(int i=0;i<ty-sy;i++) cout<<'D';
    cout<<'L';
    for(int i=0;i<=ty-sy;i++) cout<<'U';
    for(int i=0;i<=tx-sx;i++) cout<<'R';
    cout<<"DR";
    for(int i=0;i<=ty-sy;i++) cout<<'D';
    for(int i=0;i<=tx-sx;i++) cout<<'L';
    cout<<'U'<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int a[100000],n;

int binarySearch(int key){
  int left=0, right=n, mid;

  while(left<right){
    mid=(left+right)/2;
    
    if(a[mid]==key)
      return 1;
    else if(key<a[mid])
      right=mid;
    else
      left=mid+1;
  }
  return -1;
}

int main(){
  int count=0,i,q,b;

  scanf("%d",&n);
  for(i=0; i<n; i++)
    scanf("%d",&a[i]);

  scanf("%d",&q);
  for(i=0; i<q; i++){
    scanf("%d",&b);
    if(binarySearch(b)==1)
      count++;
  }

  printf("%d\n",count);

  return 0;
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
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; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 1000000007;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName

template <typename T>ostream &operator<<(ostream &out,const vector<T> &v) {rep(i,(int)v.size()-1)cout<<v[i]<<" ";cout<<v[(int)v.size()-1];return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const map<T1, T2> &p) {out << "(" << p.first << ", " << p.second << ")";return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const pair<T1, T2> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template<class T>void debag(const T &obj){cout<<obj<<endl;}

bool solve(){
  //dp[i][j]...s[0,i)とt[0,j)の最長部分列
  string s,t;cin>>s>>t;
  ll n=s.size();
  ll m=t.size();
  vector<vector<ll>>dp(n+1,vector<ll>(m+1,0));
  using P=pair<ll,pair<ll,ll>>;
  using Pl=pair<ll,ll>;
  vector<vector<P>>from(n+1,vector<P>(m+1,P(0,Pl(-1,-1))));

  // cout<<"dp"<<endl;
  // rep(i,n+1)cout<<dp[i]<<endl;

  rep(i,n+1)rep(j,m+1){
    if(i==0 or j==0){
      dp[i][j]=0;
      continue;
    }

    if(chmax(dp[i][j],dp[i-1][j]))from[i][j]=P(0,Pl(i-1,j));
    if(chmax(dp[i][j],dp[i][j-1]))from[i][j]=P(0,Pl(i,j-1));

    if(s[i-1]==t[j-1]){
      if(chmax(dp[i][j],dp[i-1][j-1]+1))from[i][j]=P(1,Pl(i-1,j-1));
    }
  }

  vector<pair<ll,ll>>v;
  ll x=n,y=m;
  string ans;
  while(x!=-1 and y!=-1){
    if(from[x][y].first==1)ans.push_back(s[from[x][y].second.first]);
    auto p=from[x][y].second;
    x=p.first;
    y=p.second;
  }

  reverse(all(ans));

  cout<<ans<<endl;

  return false;
}

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


Measured memory_bytes: 281984
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p = Mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	int a, b, k;
	cin >> a >> b >> k;
	for (int i = 100;; i--) {
		if (a%i == 0 && b%i == 0) {
			k--;
		}
		if (!k) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int main() {
  int n,l;
  cin >> n >> l;
  int a[n];
  REP(i,n) {
    cin >> a[i];
  }
  typedef pair<int,int> pii;
  priority_queue<pii, vector<pii>, greater<pii> > Q;
  REP(i, n) {
    bool f = 1;
    if (i && a[i-1] >= a[i]) f = 0;
    if (i<n-1 && a[i+1] >= a[i]) f = 0;
    if (f) {
      Q.push(pii(l-a[i], i));
    }
  }
  int ans;
  while(!Q.empty()) {
    pii p = Q.top(); Q.pop();
    int t = p.first;
    int s = p.second;
    //cout << t << " " << s << endl;
    ans = t;
    a[s] = 0;
    if (s>=2 && a[s-1] > a[s-2]) Q.push(pii(t+l-a[s-1], s-1));
    if (s<=n-3 && a[s+1] > a[s+2]) Q.push(pii(t+l-a[s+1], s+1));
    if (s==1 && a[0]) Q.push(pii(t+l-a[0], 0));
    if (s==n-2 && a[n-1]) Q.push(pii(t+l-a[n-1], n-1));
  }
  cout << ans << endl;
}

Measured memory_bytes: 1692
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int x;
  cin >> x;
  int ans = 8;
  if (1800 <= x) {
    ans = 1;
  } else if (1600 <= x) {
    ans = 2;
  } else if (1400 <= x) {
    ans = 3;
  } else if (1200 <= x) {
    ans = 4;
  } else if (1000 <= x) {
    ans = 5;
  } else if (800 <= x) {
    ans = 6;
  } else if (600 <= x) {
    ans = 7;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
#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);
}
ll a[5];
int main()
{
    scanf("%lld %lld %lld",&a[0],&a[1],&a[2]);
    for(int i=0;i<3;i++)
        if(a[i]%2==0)
        {
            printf("0\n");
            return 0;
        }
    printf("%lld\n",min(a[0]*a[1],min(a[0]*a[2],a[1]*a[2])));
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	vector<ll> w;
	REP(i,31) {
		REP(j,31) {
			w.pb(a*i+j*b);
		}
	}
	vector<ll> s;
	REP(i,3001) {
		REP(j,3001) {
			s.pb(i*c+j*d);
		}
	}
	s.pb(0);
	sort(ALL(s));
	ld p=-1;
	ll resa=0,resb=0;
	REP(i,w.size()) {
		if(w[i]*100>f) continue;
		ll sug=min(w[i]*e,f-w[i]*100);
		auto ite=upper_bound(ALL(s),sug);
		--ite;
		if(100*(*ite)/(ld)(w[i]*100+*ite)>p) {
			p=100*(*ite)/(ld)(w[i]*100+*ite);
			resa=100*w[i];
			resb=*ite;
		}
	}
	cout<<resa+resb<<" "<<resb<<endl;
}


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

#define _ cin.tie(0);ios::sync_with_stdio(false);
llong a,b;
int main(){ _;
  cin>>a>>b;
  FOR(i,1,4){
    if((a*b*i)%2==1){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


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

int main() {
    int N;
    long long C;
    cin >> N >> C;
    vector<long long> x(N), v(N);
    for(int i=0; i<N; ++i) cin >> x[i] >> v[i];

    vector<long long> vd(N+1, 0), v2d(N+1, 0);
    long long sum = 0;
    for(int i=0; i<N; ++i) {
        sum += v[i];
        vd[i+1] = max(vd[i], sum - x[i]);
        v2d[i+1] = max(v2d[i], sum - 2LL * x[i]);
    }

    long long res = vd[N];
    sum = 0;
    for(int i=N-1; i>=0; --i) {
        sum += v[i];
        res = max({res, sum - 2LL * (C - x[i]) + vd[i], sum - (C - x[i]) + v2d[i]});
    }
    cout << res << endl;
}

Measured memory_bytes: 3328
let () = Scanf.scanf "%d\n" @@ fun n ->
  let vs = Array.init n @@ fun _ -> Scanf.scanf " %d" Fun.id in
  let cs = Array.init n @@ fun _ -> Scanf.scanf " %d" Fun.id in
  let ans = Array.fold_left (fun res i -> res + max 0 (vs.(i) - cs.(i))) 
    0 @@ Array.init n Fun.id in
  Printf.printf "%d\n" ans

Measured memory_bytes: 3852
using System;

namespace AtCoderDebug
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            if(a * b % 2 == 1)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 13140