akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <queue>
#include <stack>
#include <iomanip>
#include <ctype.h>
#include <map>
#include <set>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <sstream>
#include <math.h>
#include <time.h>
#include <iostream>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <tuple>
#include <cmath>
#include <stdio.h>      /* printf, fgets */
#include <stdlib.h>
#include <fstream>

using namespace std;

typedef long long LL;

#define FOR(i,n) for(int i = 0;i < n;i++)
#define MP make_pair
#define PB push_back
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define CLEAR(a) memset(a, 0, sizeof(a))
#define ERASE(a) memset(a, -1, sizeof(a))
#define INF 2000000007LL
#define y1 uu1
#define y2 uu2
const double EPS = 1E-12;
const double PI = acos(-1.0);
const LL mod = 1000000007;

using namespace std;

int n, k;
LL h[305];
LL dp[305][305];

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  FOR(i, n) {
    cin >> h[i+1];
  }
  h[n+1] = 0;
  ERASE(dp);
  dp[0][k] = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (dp[i][j] != -1) {
        for (int usek = 0; usek <= j; usek++) {
          if (i+usek+1 > n+1) break;

          LL nv = dp[i][j];
          if (h[i+usek+1] > h[i]) nv += (h[i+usek+1] - h[i]);
          //cerr << i << ' ' << j << " nv " << nv << endl;

          if (dp[i+usek+1][j-usek] == -1) dp[i+usek+1][j-usek] = nv;
          else dp[i+usek+1][j-usek] = min(dp[i+usek+1][j-usek], nv);
        }
      }
    }
  }

  LL ans = 300 * INF;
  FOR(i, k+1) ans = min(ans, dp[n+1][i]);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int h,w,n;
int b[110][110];

struct coord{
    int x,y;
};

coord cor(int c){
    coord rtn;
    int _h = c/w;
    int _w;
    if(_h%2==0){
        _w =c%w;
    }else{
        _w = w-c%w-1;
    }
    rtn.y = _h;
    rtn.x = _w;
    return rtn;
}

void fill(int start,int a,int color){
    coord c;
    c = cor(start);
    REP(i,a){
        c = cor(start+i);
        b[c.y][c.x] = color;
    }
}


int main(void){
    cin >> h >> w >> n;
    vector<int> a(n);
    REP(i,n){
        cin >> a[i];
    }
    int cnt = 0;
    REP(i,n){
        fill(cnt,a[i],i);
        cnt += a[i];
    }
    REP(i,h){
        REP(j,w-1){
            cout << b[i][j]+1 << " ";
        }
        cout << b[i][w-1]+1 << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ar[n];
  for(int i=0;i<n;i++)
  {
    cin>>ar[i];
  }
  int N = sizeof(ar)/sizeof(ar[0]); 
  sort(ar,ar+N);
  int i=ar[0];
  long long x=1001001001;
  for(i;i<=ar[n-1];i++)
  {  long long sum=0;
    for(int j=0;j<n;j++)
    {
      sum+=pow((ar[j]-i),2);
    }
   x=min(sum,x);
  }
  cout<<x;
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int N=1e5 + 5;
const int M=1e9 + 7;

string inttos(int num)
{
    return to_string(num);
}

int stoint(string sss)
{
    return stoi(sss);
}

int32_t main()
{
	IOS;
	//memset(dp,-1,sizeof(dp));	
	int T;
	T=1;
	while(T--)
	{
		int n;
		cin >> n;
		int ans=0;
		rep(i,1,n)
		{
			rep(j,1,n)
			{
				rep(k,1,n)
				{
					int x = __gcd(i,j);
					x = __gcd(x,k);
					ans += x;
				}
			}
		}
		cout << ans << endl;
	}
}


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

typedef int integer;

#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define pb push_back
#define bs binary_search
#define up upper_bound
#define lw lower_bound
#define fs first 
#define sd second 
#define mp make_pair    

#define fore(i,a,b) for(ll i = a; i < b; i++)
#define rfore(i, a, b) for(ll i = a - 1; i >= b; i--)
#define forev(a,b) fore(i,0,b)cout<<a[i]<<" "; 
#define mm(a,b) memset(a , b , sizeof a) 
#define ALL(a) a.begin(),a.end() 
#define SZ(n) ((ll) (n).size())

#define infi  2e9
#define int long long
#define endl '\n'
const ld pi = 3.14159265358979323846;
const ll mod = 1e9+7;
const ll INF = 1e10;
const ld EPS = 1e-8;

typedef pair<ll,ll> pll;

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

const int MAXN = 200000;
const int K=20;

int n,w;
int dp[101][MAXN];
int p[101],v[101]; 

int solve(int pos, int curw){
	if(curw>w)return -INF;
	if(pos==n)return 0;
	int &r = dp[pos][curw];
	if(r!=-1)return r;
	r = max(v[pos]+solve(pos+1,curw+p[pos]),solve(pos+1,curw));
	return r; 
}

integer main(){
	cin>>n>>w;
	fore(i,0,n)cin>>p[i]>>v[i];
	mm(dp,-1);
	cout<<solve(0,0);
    return 0;
}



Measured memory_bytes: 158080
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val ab = inputs.head.split(" ")
  val a = ab(0)
  val b = ab(1)

  println(solve(a, b))

  private def solve(a: String, b: String): String = {
    if (a == b) {
      return "H"
    } else {
      return "D"
    }
  }
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  for(int i=0;i<10000;i++){
    C-=B;
    if(C<=0){
      cout << "Yes" << endl;
      break;
    }
    A-=D;
    if(A<=0){
      cout << "No" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
#include<string>
#include<vector>
#define rep(X,Y) for(int (X)=0;(X)<(Y);++(X))

typedef long long ll;

using namespace std;

int main(){
  ll n,b,c,a,x;
  while(cin>>n>>a>>b>>c>>x){
    if(!n)break;
    int cnt=0,ub=10000;
    vector<ll> yy(n);
    rep(i,n)cin>>yy[i];
    rep(i,n){
      ll y=yy[i];
      while(x!=y){
	x=(a*x%c+b)%c;
	if(++cnt>ub){cnt=-1;break;}
      }
      if(cnt<0)break;
      if(i!=n-1){x=(a*x%c+b)%c; ++cnt;}
    }
    cout<<cnt<<endl;
  }
}

Measured memory_bytes: 1196
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt(), W = sc.nextInt();   //N_max = 100, v_max = 1000
        long[] w = new long[N];
        int[] v = new int[N];
        for(int i=0;i<N;i++){
            w[i] = sc.nextInt();
            v[i] = sc.nextInt();
        }
        int v_sum = sumOfArrValue(v);
        long w_sum = sumOfArrValue(w);
        long[] minWeight = new long[v_sum+1];   //価値を超えるために必要な最小重量
        for(int i=0;i<v_sum+1;i++){
            minWeight[i] = w_sum;
        }
        for(int i=0;i<N;i++){
            for(int j=0;j<v_sum+1;j++){
                if(j + v[i] <= v_sum){
                    minWeight[j] = Math.min(minWeight[j], minWeight[j + v[i]] - w[i]);
                }
                //System.out.print(minWeight[j] + ", ");
            }
            //System.out.println();
        }
        boolean flag = true;
        for(int i=0;i<v_sum+1;i++){
            if(minWeight[i] > W){
                System.out.println(i-1);
                flag = false;
                break;
            }
        }
        if(flag)
            System.out.println(v_sum);
    }

    private static int sumOfArrValue(int[] arr){
        int sum = 0;
        for(int i : arr){
            sum += i;
        }
        return sum;
    }

    private static long sumOfArrValue(long[] arr){
        long sum = 0;
        for(long l : arr){
            sum += l;
        }
        return sum;
    }
}


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

const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a%=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}

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

  int n,x;
  cin >> n >> x;
  vector<int> s(n);
  rep(i,n) cin >> s[i];
  int limit = 1e5+1;
  vector<ll> dp(limit,0);
  sort(s.rbegin(),s.rend());
  dp[x] = 1;
  rep(i,n){
    vector<ll> ndp(limit,0);
    rep(j,limit){
      if(dp[j]>0){
        int ni = j%s[i];
        ndp[ni] = ad(ndp[ni],dp[j]);
        ndp[j] = ad(ndp[j],mu(dp[j],(n-1-i)));
      }
    }
    swap(dp,ndp);
  }
  ll ans =0;
  rep(i,limit){
    ans = ad(ans,mu(i,dp[i]));
  }
  cout << ans << endl;
  return 0;
    

}


Measured memory_bytes: 1888
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define pa pair<int,int>
#define mod 998244353
#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define cl(x) memset(x,0,sizeof x)
#ifdef Devil_Gary
#define bug(x) cout<<(#x)<<" "<<(x)<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define bug(x)
#define debug(...)
#endif

const int INF = 0x7fffffff;
const int N=2e3+5;
/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=(TT=but)+fread(but,1,1<<15,stdin),TT==mo))?-1:*TT++)//*/
inline int read(){
    int x=0,rev=0,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')rev=1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return rev?-x:x;
}/*
struct Edge{
	int nxt,v;
//	int w;
//	int id;
}e[N<<1];
void add(int u,int v){
	e[++tot].v=v,e[tot].nxt=head[u],head[u]=tot;
	e[++tot].v=u,e[tot].nxt=head[v],head[v]=tot;
}*/
priority_queue<pair<int,pa> > heap;
char s[N][N];
int d[N][N];
int n,m,sx,sy,tx,ty;
int x[4]={1,-1,0,0},y[4]={0,0,1,-1};
int main(){
#ifdef Devil_Gary
    freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
#endif
	n=read(),m=read();
	memset(d,127/3,sizeof d);
	sx=read(),sy=read(),tx=read(),ty=read();
	d[sx][sy]=0;
	for(int i=1;i<=n;i++) cin>>s[i]+1;
	heap.push(mk(0,mk(sx,sy)));
	while(1){
		for(;!heap.empty()&&-d[heap.top().se.fi][heap.top().se.se]!=heap.top().fi;heap.pop());
		if(heap.empty()) break;
		pa now=heap.top().se;
		heap.pop();
//		cout<<now.fi<<" "<<now.se<<" "<<d[now.fi][now.se]<<endl; 
		for(int i=0;i<4;i++){
			int nx=now.fi+x[i],ny=now.se+y[i];
			if(nx<1||nx>n||ny<1||ny>m) continue;
//			if(s[now.fi][now.se]=='#'&&s[nx][ny]=='#') continue;
			if(s[nx][ny]=='#') continue;
//			cout<<nx<<" "<<ny<<endl;
//			int flg=(s[nx][ny]=='#');
			if(d[nx][ny]>d[now.fi][now.se]){
				d[nx][ny]=d[now.fi][now.se];
				heap.push(mk(-d[nx][ny],mk(nx,ny))); 
			}
		}
		for(int i=now.fi-2;i<=now.fi+2;i++)
			for(int j=now.se-2;j<=now.se+2;j++){
				if(i<1||i>n||j<1||j>m) continue;
				
				if(s[i][j]=='#') continue;
				if(d[i][j]>d[now.fi][now.se]+1){
					d[i][j]=d[now.fi][now.se]+1;
					heap.push(mk(-d[i][j],mk(i,j))); 
				}
			}
	}
	if(d[tx][ty]==d[0][0]) puts("-1"); 
	else cout<<d[tx][ty]<<endl;
	return 0;
}


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

int main(void){
    // Your code here!
    int backet[26] = {};
    int res = 0;
    string s;
    string alpha = "abcdefghijklmnopqrstuvwxyz";
    cin >> s;
    
    for (int i = 0; i < alpha.size(); ++i){
        for (int j = 0; j < s.size(); ++j){
            if (s[j] == alpha[i]){
                backet[i] = 1;
            }
        }
    }
    
    for (int i = 0; i < sizeof(backet)/sizeof(int); ++i){
        if (backet[i] == 0){
            cout << alpha[i] << endl;
            res = 1;
            break;
        }
    }
    if (res == 0) cout << "None" << endl;
    return 0;
}


Measured memory_bytes: 512
/*
const int N = 1e5+100;
const int LIM = 17; // cf 620div2

vector<int> g[N];
int par[N][LIM+1], depth[N];

void build(int cur, int p) {
    depth[cur] = depth[p]+1;
    par[cur][0] = p;
    _rep(i,1,LIM) 
        par[cur][i] = par[par[cur][i-1]][i-1];
    for(auto it : g[cur]) {
        if(it != p) build(it, cur);
    }
    return;
}
int lca_len(int a, int b) {
    int len = 0;
    if(depth[a] > depth[b]) swap(a, b);
    for(int i = LIM; i >= 0; i--) {
        if(depth[par[b][i]] >= depth[a])
            b = par[b][i], 
            len += (1<<i);
    }
    if(a == b) return len;
    for(int i = LIM; i >= 0; i--) {
        if(par[a][i] != par[b][i]) {
            a = par[a][i]; 
            b = par[b][i];
            len += (1<<(i+1));
        }
    }
    return len+2;
}

void taskE() {
    int n; cin >> n;
    
    _for(i,1,n) {
        int x,y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    build(1, 0);
    int q; cin >> q;
    while(q--) {
        int x,y,a,b,k; cin >> x >> y >> a >> b >> k;
        int x1 = lca_len(a, b);
        int x2 = min(lca_len(a, x)+lca_len(y, b), lca_len(a, y)+lca_len(x, b)) + 1;

        int ans = INT_MAX;
        if(x1%2 == k%2) ans = x1;
        if(x2%2 == k%2) ans = min(ans, x2);
        cout << (ans <= k ? "YES\n" : "NO\n");
    }
    return;
}
*/


#include <bits/stdc++.h> //cfGlobalRound7
using namespace std;
#define ll long long
#define all(v) (v).begin(), (v).end()
#define _for(i,a,b) for(int i = (a); i < (b); i++) 
#define _rep(i,a,b) for(int i = (a); i <= (b); i++)

void taskcf(){
    string s; cin >> s;
    int a = 0, b = 0, n = s.size();
    _for(i,0,n) {
        if(s[i] == 'C') a = 1;
        if(a && s[i] == 'F') b = 1;
    }
    cout << (a&b ? "Yes\n" : "No\n");
    return;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    //taskA();
    //taskB();
    //taskC();
    //taskD1();
    taskcf();
    //taskE();  
    //taskF1();
    //taskF2();
    return 0;
}


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

using namespace std;

const int INF = 1e9 + 5;

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i=0; i<n; i++)
        cin >> h[i];
    vector<int> dp(n, INF);
    dp[0] = 0;
    for (int i=0; i<n; i++)
    {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i+1]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i+2]));
    }
    cout << dp[n-1] << "\n";
}

Measured memory_bytes: 1024
#include <utility>
#include <vector>
#include <iostream>
#define REP(i, n) for(int i=0; i<n; i++)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n;
long long a[100010][3];

long long dp[100010][3];

int main(){
    cin >> n;
    REP(i, n) REP(j, 3) cin >>a[i][j];
    
    REP(i, n){
        REP(j, 3){
            REP(k, 3){
                if (j == k) continue;
                chmax(dp[i+1][k], dp[i][j] + a[i][k]);
            }
        }
    }
    
    long long res = 0;
    REP(j, 3) chmax(res, dp[n][j]);
    cout << res << endl;
}


Measured memory_bytes: 4992
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
mod=1000000007


    
n,d=mi()
ans=0
for i in range(n):
    x,y=mi()
    x1=x*x+y*y
    x1=sqrt(x1)
    if x1<=d:
        ans+=1
print(ans)
    
    
        
    


Measured memory_bytes: 70036
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    cout << 48 - n << endl;

    return 0;
}





Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0;
  cin >> N;
  if(N == 3 || N == 5 || N == 7){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}

Measured memory_bytes: 3584
#include <iostream>
int main(){
        int N[4],result[10];

        for(int i=0; i<4; i++) {
                std::cin >> N[i];
                result[N[i]]=1;
        }
        if(result[1]==1&&result[4]==1&&result[7]==1&&result[9]==1) std::cout << "YES";
        else std::cout << "NO";
        return 0;
}


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

int main(){
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    pair<double, pair<int, int> > ma;
	ma.first = 0;
	ma.second.first = 100*a;
	ma.second.second = 0;
 
	for (int i = 0; i <= 30; i++) {
		for (int j = 0; j <= 30; j++) {
			if (100*a*i + 100*b*j > f) continue;
			for (int x = 0; x <= 100000; x++) {
				int dy = min(e*(a*i+b*j)-c*x, f-100*a*i-100*b*j-c*x);
				if (dy < 0) continue;
				int y = dy/d;
				int w = 100*a*i+100*b*j, v = c*x+d*y;
				if (ma.first < v/(double)(w+v)) {
					ma.first = v/(double)(w+v);
					ma.second.first = w+v;
					ma.second.second = v;
				}
			}
		}
	}
	cout << ma.second.first << " " << ma.second.second << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;
string str;
int D;
int dp[10010][101][2];
// pos can vary upto 10,000
// d can vary from 0 to 100 as d = (D+d - x%D)%D
// tight varies 0 or 1

int digitdp(int pos = 0, int d = 0, bool tight = true) {

	if (dp[pos][d][tight] != -1)
		return dp[pos][d][tight];

	int limit = (tight) ? (str[pos] - '0') : 9;

	if (pos == str.length() - 1) {
		int ans = 0;
		for (int x = 0; x <= limit; x++)
			if (x % D == d)
				ans++;
		return ans;
	}

	int ans = 0;
	for (int x = 0; x <= limit; x++)
		ans = (ans + digitdp(pos + 1, (D + d - x % D) % D, tight && (x == limit))) % mod;
	return dp[pos][d][tight] = ans;
}
int32_t main()
{
	cin >> str >> D;
	memset(dp, -1, sizeof dp);
	cout << (mod + digitdp() - 1) % mod << endl;
	return 0;
}


Measured memory_bytes: 16896
import sys
input=sys.stdin.readline
h,w,k=map(int,input().split())
si,sj,ti,tj=map(int,input().split())
si-=1
sj-=1
ti-=1
tj-=1
b=[input()for _ in range(h)]
ans=[[-1]*w for _ in range(h)]
ans[si][sj]=0
from collections import deque
d=deque()
d.append((si,sj))
while d:
  x,y=d.popleft()
  if x==ti and y==tj:
    exit(print(ans[x][y]))
  for dx,dy in [[1,0],[-1,0],[0,-1],[0,1]]:
    for i in range(1,k+1):
      xx=x+dx*i
      yy=y+dy*i
      if not(0<=xx<h and 0<=yy<w) or b[xx][yy]=="@":break
      if 0<=ans[xx][yy]<=ans[x][y]:break
      if ans[xx][yy]==-1:d.append((xx,yy))
      ans[xx][yy]=ans[x][y]+1
print(-1)

Measured memory_bytes: 93524
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{

  int n, k;
  cin >> n >> k;

  vector<int> a(n);

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

  for (int i = k; i < n; i++)
  {
    if (a[i - k] < a[i])
    {
      cout << "Yes" << endl;
    }
    else
    {
      cout << "No" << endl;
    }
  }

  return 0;
}

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

int main() {
  int n, i, sum = 0;
  cin >> n;
  vector<int> a(n), b(n-1);
  rep(i, n-1) cin >> b.at(i);

  a.at(0) = b.at(0);
  a.at(n-1) = b.at(n-2);

  for(i=1; i<n-1; i++){
    a.at(i) = min(b.at(i-1), b.at(i));
  }

  rep(i,n){
    sum += a.at(i);
    // cout << a.at(i) << " ";
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
n=input()
t_p=0
h_p=0
for i in range(int(n)):
    t,h=input().split()
    a=sorted([t,h])
    if t == h:
        t_p+=1
        h_p+=1
    elif t  == a[1]:
        t_p+=3
    else:
        h_p+=3
print(t_p, h_p)

Measured memory_bytes: 7640
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
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; }

void solve(long long x){
    cout<<1-x<<endl;
}
int main(){
    long long x;
    scanf("%lld",&x);
    solve(x);
    return 0;
}


Measured memory_bytes: 3184
import java.util.Scanner;

public class Main {

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

		boolean check = true;
		for(int i = 0; i < S.length(); i++) {
			if(i % 2 == 0) {
				if(S.charAt(i) == 'L') {
					check = false;
					break;
				}else {
					continue;
				}
			}else {
				if(S.charAt(i) == 'R') {
					check = false;
					break;
				}else {
					continue;
				}
			}
		}
		System.out.println(check ? "Yes" : "No");
	}

}

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

using namespace std;

int points[12][12];

int main(void)
{
	int n, d;
	cin >> n >> d;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < d; ++j)
		{
			cin >> points[i][j];
		}
	}
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = i + 1; j < n; ++j)
		{
			int sum = 0;
			for (int k = 0; k < d; ++k)
			{
				sum += (points[i][k] - points[j][k]) * (points[i][k] - points[j][k]);
			}
			int a = (int)sqrt((double)sum);
			//cout << a << " " << sum << endl;
			if (a * a == sum)
			{
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
	ll x,y;
	cin >> x >> y;
	int cnt=0;
	while((x<<cnt)<=y){
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}
/*
//素因数分解した結果をres[]に入れる
for(int i=2; i<=num; i++){
	while(c%i==0){
		res[i]++;
		c/=i;
	}
}
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	long long int n,t,tt,max,min,num,i;
	cin >> n;
	cin >> t;
	if(n==1)cout << t << endl;
	else {
		for(i=0;i<n-1;i++){
			cin >> tt;
			if(tt>t){
				max=tt;
				min=t;
			}
			else {
				max=t;
				min=tt;
			}
			num=max;
			while(num%min!=0)num+=max;
			t=num;
		}
		cout << num << endl;
	}
	return 0;
}

	
		

Measured memory_bytes: 384
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int n,i,m;
vector<int> a;

inline void solve(){
  IN(n);
  a.resize(n);
  INS(i,n,a);
  m=n;
  --n;
  while(n!=-1&&n!=-2){
    cout<<a[n]<<" ";
    n-=2;
  }
  if(n==-2)n=1;
  else n=0;
  while(n!=m){
    cout<<a[n]<<" ";
    n+=2;
  }
  cout<<endl;
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

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

ll lcm(ll a, ll b)
{
	return a * (b / gcd(a, b));
}
int main()
{
	int N;
	cin >> N;
	ll ans = 1;
	for (int i = 0; i < N; i++) {
		ll T;
		cin >> T;
		ans = lcm(ans, T);
	}
	cout << ans << endl;
}


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

int main(){
  int N, Y;
  cin >> N >> Y;
  int flag = false;
  for(int x = 0; x <= N; x++){
    for(int y = 0; y <= N; y++){
      if(x + y > N){
        break;
      }
      int z = N - x - y;
      if(x * 10000 + y * 5000 + z * 1000 == Y){
        flag = true;
        cout << x << " " << y << " " << z << endl;
        break;
      }
    }
    if(flag){
      break;
    }
  }
  if(!flag){
    cout << -1 << " " << -1 << " " << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,boundary=1,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

h,w=LI()
h,w,g,_=GGI(h,w,boundary=-1)
dp=[1e6]*(h*w)
dp[w+1]=g[w+1]

for j in range(h*w-w):
    if g[j]==-1:continue
    for d in (1,w):
        dp[j+d]=min(dp[j]+(g[j]*2+g[j+d]==1),dp[j+d])

print(dp[-w-2])

Measured memory_bytes: 41324
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N, M = (int(_) for _ in input().split())
    L = []
    R = []
    D = []
    for i in range(M):
        s1,s2,s3 = (int(_) for _ in input().split())
        L.append(s1)
        R.append(s2)
        D.append(s3)
    if M ==0:
        print('Yes')
        return
    adj = [[] for _ in range(N)]
    for i in range(M):
        adj[L[i]-1].append([R[i]-1,D[i]])
        adj[R[i]-1].append([L[i]-1,-1*D[i]])

    dist = [None for _ in range(N)]
    for i in range(N):
        if dist[i] is not None:
            continue
        stack = [i]
        dist[i] = 0
        while stack:
            v=stack.pop()
            for to,cost in adj[v]:
                if dist[to] is None:
                    stack.append(to)
                    dist[to] = dist[v]+cost
                elif dist[to] != dist[v] +cost:
                    print('No')
                    return
        
    print('Yes')
    
if __name__ == '__main__':
    main()


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

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	vector<int> ct(10001);
	for (int a = 1; a <= 100; ++a)
		for (int b = 1; b <= 100; ++b)
			for (int c = 1; c <= 100; ++c) {
				int x = a*a + b*b + c*c + a*b + a*c + b*c;
				if (x >= 0 && x < 10001) ++ct[x];
			}
	for (int i = 1; i <= n; ++i)
		cout << ct[i] << '\n';
}

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

int main()
{
	int H, W;
	int mas[105][105];
	int N;
	int A[10005];

	cin >> H >> W >> N;
	
	for(int i = 0; i < N; i++) {
		cin >> A[i];
	}

	int cnt = 0;
	for(int i = 0; i < H; i++) {
		if(i % 2) {
			for(int j = 0; j < W; j++) {
				mas[i][j] = cnt + 1;
				A[cnt]--;
				if(A[cnt] == 0) cnt++;
			}
		} else {
			for(int j = W - 1; j >= 0; j--) {
				mas[i][j] = cnt + 1;
				A[cnt]--;
				if(A[cnt] == 0) cnt++;
			}
		}
	}

	for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			cout << mas[i][j];
			if(j == W - 1) cout << endl;
			else cout << " ";
		}
	}

	return (0);
}


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

///--->>> CONTAINERS <<<---///
using i64 = int64_t;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vector< ll > >;
using vpi = vector<pair<ll,ll> >;
using pi = pair<ll,ll>;
using st = set<ll>;
using stk = stack<ll>;
using kiwi = queue<ll>;
using pkiwi = priority_queue<ll>;
using mp = map<ll,ll>;
using ump = unordered_map<ll,ll>;

///--->>> MACROS<<<---///
const ll mx = 3e5+123;
#define MOD 1000000007
#define REP(i,n) for (ll i=1;i<=n;++i)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

///--->>>OPTIMIZE<<<---///
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

///--->>> DEBUGGER<<<---///
#define dbg(args...) do {cerr<<#args<<" : "; diraf(args); } while(0)
void diraf ()  {        cerr << endl;}
template < typename T, typename ... hello>void diraf( T arg, const hello &... rest) {cerr<<arg<< ' ';diraf(rest...);}

int main(int argc, char* argv[]){
    fastio;
    ///freopen("input.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    ///cout<<fixed<<setprecision(20);
    ll n, cnt=0, mn=0; cin>>n;
    for(ll i=1;i<n;++i){
           /// if(i*i>n) break;
        for(ll j=1;;++j){
            if(i*j>=n) break;
            ///dbg(i,j);
            ///if((ceil(log2(i*j))==floor(log2(i*j)))&& i==j) mn++;
            cnt++;
        }
    }
    cout<<cnt-mn<<endl;
return 0;
}


Measured memory_bytes: 3640
n = int(input())
edgeList = []
for i in range(n):
    a = list(map(int, input().split()))
    for j in range(i):
        if a[j] != -1:
            edgeList.append([a[j], i, j])
rootList = [-1]*n
sumLength = 0

def getRoot(x):
    r = rootList[x]
    if r < 0:
        rootList[x] = x
    elif r != x:
        rootList[x] = getRoot(r)
    return rootList[x]
        

edgeList.sort(key=lambda x: x[0])
for e in edgeList:
    x = getRoot(e[1])
    y = getRoot(e[2])
    if x != y:
        sumLength += e[0]
        rootList[x] = rootList[y] = min(x, y)
print(sumLength)

Measured memory_bytes: 6116
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
#define PI 3.141592653589793
//#define MOD 1000000007
#define MOD 998244353
#define ALL(obj) (obj).begin(),(obj).end()
const ll INF = 1LL << 60;
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;

ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
struct UnionFind {
    vector<ll> par,rank,con;
    UnionFind(ll n) : par(n,-1),rank(n,0),con(n,1) { }
    ll root(ll x){
        if (par[x]<0)return x;
        return par[x]=root(par[x]);
    }
    bool unite(ll x,ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        con[x] += con[y];
        return true;
    }
    bool same(ll x,ll y){
        ll rx=root(x);
        ll ry=root(y);
        return rx==ry;
    }
    ll size(int x) {
        return -par[root(x)];
    }
};


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

    UnionFind uf(n);
    for (ll i=0;i<m;i++){
        ll a,b;
        cin >> a >>b;
        a--;
        b--;
        uf.unite(a,b);
    }
    ll ans=-1;
    bool r[n];
    fill(r,r+n,false);
    for (ll i=0;i<n;i++){
        if (!r[uf.root(i)]){
            ans++;
            r[uf.root(i)]=true;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5612
#include<cstdio>
#include<cstring>
#include<string>
char s[100000+10];
/*int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    int ans = a>2*b ? a-2*b : 0;
    printf("%d\n",ans);
    return 0;
}

int d[55];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 1;i <= n;i ++)
    {
        scanf("%d",&d[i]);
    }
    int ans = 0;
    for(int i = 1;i <= n;i ++)
    {
        for(int j = i+1;j <= n;j ++)
        {
            ans += d[i]*d[j];
        }
    }
    printf("%d\n",ans);
    return 0;
}
*/

int main()
{
    int len;
    scanf("%d%s",&len,s);
    int cur = 0;
    int cnt = 1;
    while(cur != len-1)
    {
        if(s[cur] != s[cur+1])
            cnt ++;
        cur ++;
    }
    printf("%d\n",cnt);
    return 0;
}

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

def cf(x1,x2):
    cf=[]
    n =max(x1,x2)
    m=min(x1,x2)
    for i in range(1,int(m**0.5)+1):
        if m % i == 0:
          if n % i == 0:
            cf.append(i)
          if i != m//i and n % (m//i) == 0:
            cf.append(m//i)
    return cf

def is_prime(z):
  for i in range(2,int(z**0.5)+1):
    if i*i > z:
      break
    if z % i == 0:
      return False
  return True

tmp=cf(a,b)
sum=0
y=[]
for k in tmp:
  if is_prime(k):
    sum += 1

print(sum)

Measured memory_bytes: 3268
from collections import Counter
alphabet='abcdefghijklmnopqrstuvwxyz'

N=int(raw_input())
S=raw_input()

st2 = Counter(S)
st1 = Counter()
best = 0
for i in range(N-1):
  st1.update(S[i])
  cnt = 0
  for k,v in st1.items():
    if st2[k] - v > 0:
      cnt += 1
  best = max(best, cnt)
print best

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

using namespace std;

using ll = long long;
using p_int = pair<int, int>;
struct edge { int from, to, cost; };

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

    int INF = (int) 1e7 + 1;
    int V, E, r;
    cin >> V >> E >> r;
    edge es[E];
    vector<edge> g[V];
    for (int i = 0; i < E; ++i) {
        edge e{};
        cin >> e.from >> e.to >> e.cost;
        es[i] = e;
    }

    int d[V];
    fill(d, d + V, INF);
    d[r] = 0;
    bool update = false;
    for (int i = 0; i < V; ++i) {
        for (auto e: es) {
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
                if (i == V -1) {
                    cout << "NEGATIVE CYCLE\n";
                    return 0;
                }
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if (!update) break;
    }

    for (auto e: d) {
        if (e < INF) {
            cout << e << '\n';
        } else {
            cout << "INF" << '\n';
        }
    }

    return 0;
}



Measured memory_bytes: 3220
#include <stdio.h>
#include <math.h>

#define MOD 1000000007

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

long c[32][100000];

void combination() {
  for (int i=0; i<100000; i++) c[0][i] = 1;
  for (int i=1; i<32; i++) c[i][0] = 1;
  for (int i=1; i<32; i++) {
    for (int j=1; j<100000; j++) {
      c[i][j] = (c[i-1][j] + c[i][j-1]) % MOD;
    }
  }
}

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int idx=0, i, p[100000], boo = 0; long ans = 1;
  if (m==1) {
    printf("1\n");
    return 0;
  }
  for (i=2; i<sqrt((double)m); i++) {
    if (m%i != 0) continue;
    boo = 1;
    break;
  }
  if (m%i == 0) boo = 1;
  if (boo) {
    for (i=2; i<=m; i++) {
      if (m%i == 0) {
        p[idx] = 0;
        while (m%i==0) {
          m /= i;
          p[idx]++;
        }
        idx++;
      }
    }
  } else {
    p[idx] = 1;
    idx++;
  }
  combination();
  for (i=0; i<idx; i++) {
    ans = (ans * c[p[i]][n-1]) % MOD;
  }
  printf("%ld\n", ans);
  return 0;
}


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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[],int n){
    for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
    }
    cout<<endl;
}



int check(int n){

	int temp=n+9;

	temp=temp/10;
	return temp*10;



}

bool comp(int a,int b){


	return a%10 > b%10;

}

int main() {
    int i,n,m,k,c=0;
    c_p_c();
    n=5;
    // int a[n];
    vector<int> a;
    int sum=0;
    fo(i,n) {

    	cin>>k;
    	if(k%10==0)
    		sum+=k;
    	else
    		a.pb(k);

    }

    if(a.size()!=0){
    int nn = a.size();
    sort(all(a),comp);
    sum+=a[nn-1];


    // for (int i = 0; i < nn; ++i)
    // {
    // 	 code 
    // 	cout<<a[i]<<" ";
    // }
    // cout<<endl;
    // watch(sum)<<endl;


    for (int i = 0; i < nn-1; ++i)
    {
    	/* code */
    	// cout<<check(a[i])<<endl;
    	sum+=check(a[i]);
    }
    cout<<sum<<endl;

}else
	cout<<sum<<endl;
    return 0;
}



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

public class Main {

    static int H;
    static int W;
    static int[][] A;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        A = new int[H][];
        for (int i = 0; i < H; i++) {
            A[i] = sc.nextIntArray(W);
        }

        PrintWriter pw = new PrintWriter(System.out);
        List<Action> ans = solve();
        pw.println(ans.size());
        for (Action action : ans) {
            pw.println((action.h1+1) + " " + (action.w1+1) + " " + (action.h2+1) + " " + (action.w2+1));
        }
        pw.flush();
    }

    static List<Action> solve() {
        List<Action> ans = new ArrayList<>();
        for (int h = 0; h < H-1; h++) {
            for (int w = 0; w < W; w++) {
                if( A[h][w] % 2 == 1 ) {
                    A[h][w]--;
                    A[h+1][w]++;
                    ans.add(new Action(h, w, h+1, w));
                }
            }
        }
        for (int w = 0; w < W-1; w++) {
            if( A[H-1][w] % 2 == 1 ) {
                A[H-1][w]--;
                A[H-1][w+1]++;
                ans.add(new Action(H-1, w, H-1, w+1));
            }
        }
        return ans;
    }

    static class Action {
        int h1, w1;
        int h2, w2;

        public Action(int h1, int w1, int h2, int w2) {
            this.h1 = h1;
            this.w1 = w1;
            this.h2 = h2;
            this.w2 = w2;
        }
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 52532
#include<cstdio>
#include<algorithm>
int a[2001];
unsigned long long dp[2][31270];
int main() {
	int n, s=0, os;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", a + i), s += a[i];
	
	os = s;
	s /= 2;
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		int b = a[i] / 64;
		int o = a[i] % 64;
		for (int j = 0; j < 31270; j++) dp[i&1][j] = dp[(~i)&1][j];
		for (int j = 31260 - b; j >= 0; j--) {
			if(o != 0) dp[i&1][j + b + 1] |= (dp[(~i)&1][j] >> (64 - o));
			dp[i&1][j + b] |= (dp[(~i)&1][j] << o);
		}
	}
	int i;
	for (i = s; i >= 0; i--) if ((dp[n&1][i/64]>>(i%64)) & 1) break;
	printf("%d\n", os - i);
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, A, B;
  cin >> N >> A >> B;
  int ret = 0;
  for (int i = 1; i <= N; i++) {
    int d = i;
    int sum = 0;
    while (d) {
      sum += d % 10;
      d = d / 10;
    }
    if (A <= sum && sum <= B) ret += i;
  }
  print(ret);
}

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

int main() {
	int N,K;
	int Y,X,sum=0;
	cin>>N>>K>>X>>Y;
	for(int i=1;i<=N;i++){
		if(i<=K){
			sum+=X;
		}else{
			sum+=Y;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256