akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}

signed main(){
	int n;
	cin>>n;
	cout<<n*n*n<<endl;
	return 0;
}


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

using namespace std;

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)

struct edge {
    int from;
    int to;
    int cost;
};

int main() {
    int ans = 0;
    int n, m, p;
    vector<edge> edges;
    cin >> n >> m >> p;
    struct edge tmp;
    int coin;
    REP(i, m) {
        cin >> tmp.from >> tmp.to;
        cin >> coin;
        tmp.cost = -(coin - p);
        edges.push_back(tmp);
    }
    bool go[2501], come[2501];
    fill(go, go + n + 1, false);
    fill(come, come + n + 1, false);
    go[1] = come[n] = true;
    REP(i, n) {
        REP(j, m) {
            if (go[edges[j].from]) {
                go[edges[j].to] = true;
            }
            if (come[edges[j].to]) {
                come[edges[j].from] = true;
            }
        }
    }
    vector<edge> redges;
    REP(j, m) {
        if (go[edges[j].to] && go[edges[j].from] && come[edges[j].from] && come[edges[j].to]) {
            redges.push_back(edges[j]);
        }
    }

    int v[2501];
    fill(v, v + n + 1, INF);
    v[1] = 0;
    REP(i, n) {
        REP(j, redges.size()) {
            struct edge e = redges[j];
            if (v[e.from] != INF && v[e.to] > v[e.from] + e.cost) {
                v[e.to] = v[e.from] + e.cost;

                if (i == n - 1) {
                    cout << -1 << endl;
                    return 0;
                }
            }
        }
    }

    if (v[n] == INF) cout << -1 << endl;
    else cout << max(-v[n], 0) << endl;

}

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

public class Main {
  private static void execute(ContestReader reader, PrintWriter out) {
    int a = reader.nextInt();
    int b = reader.nextInt();
    int c = reader.nextInt();
    out.println(a <= c && c <= b ? "Yes" : "No");
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21204
#include <iostream>

char grade(int m,int f, int r)
{
	int sum = m+f;
	if(m == -1 || f == -1){
		return 'F';
	}else if(sum>= 80){
		return 'A';
	}else if(sum >= 65){
		return 'B';
	}else if(sum >= 50){
		return 'C';
	}else if(sum >= 30){
		if(r >= 50){
			return 'C';
		}else{
			return 'D';
		}
	}else{
		return 'F';
	}
	return 'Z';//err
}

int main(int argc, char const *argv[])
{
	int m,f,r;
	while(true){
		std::cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1) break;
		std::cout << grade(m,f,r) << std::endl;;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#define mp make_pair
typedef long long ll;
using namespace std;
long long a,b,c,d,l;
pair <long long,int> st[10];
int main(){
	cin>>a>>b>>c>>d;
	cin>>l;
	st[0]=mp(a*8,0);
	st[1]=mp(b*4,1);
	st[2]=mp(c*2,2);
	st[3]=mp(d,3);
	sort(st,st+4);
	if (st[0].second<3){
		cout<<st[0].first*l/2;
	}else{
		if (l%2==0){
			cout<<st[0].first*l/2;
		}else{
			cout<<ll(st[0].first*(l-1)/2+st[1].first/2);
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string>
#include <string.h>
#include <math.h>
#include <iomanip>
#include <stdio.h>
using namespace std;

#define int64 long long
#define pii pair <int64, int64>
#define fr first
#define sc second
#define heap priority_queue
struct piii{
    int64 fr, sc, th;
    bool operator < (const piii &b){
        if (fr != b.fr) return fr < b.fr;
        if (sc != b.sc) return sc < b.sc;
        return th < b.th;
    }
};
///////////////////////////////////////////////
///////////////////////////////////////////////

int cnt[200005];

int main(){
    cout << setprecision(2) << fixed;
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, val;
    cin >> n;
    for (int i = 1; i < n; i++){
        cin >> val;
        cnt[val]++;
    }
    for (int i = 1; i <= n; i++) cout << cnt[i] << endl;
    return 0;
}


Measured memory_bytes: 4324
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int N;
  cin >> N;
  map<string,long> m;
  for(int i=0; i<N; i++){
    string si;
    cin >> si;
    sort(si.begin(), si.end());
    if(m.find(si)==m.end()) m[si]=0;
    m[si]++;
  }
  long ret=0;
  for(auto &mi: m){
    auto &v = mi.second;
    ret += v*(v-1)/2;
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 11136
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n; cin >> n;
    vector<ll> l(n);
    REP(i, n) cin >> l[i];

    sort(ALL_OF(l));

    ll ans = 0;
    REP(i, n) REP(j, i) {
        ll m = l[i] + l[j];
        ll r = l[i] - l[j];
        ll iu = upper_bound(ALL_OF(l), r) - l.begin();
        ll il = lower_bound(ALL_OF(l), m) - l.begin();
        ans += il - max(iu, i+1);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
using namespace std;

int a[200010], p[1000010], b[200010];


int main() {
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        b[i] = a[i];
    }
    int ans = 0;
    sort(b + 1, b + n + 1);
    for(int i = 1; i <= n; i++) {
        int t = b[i];
        if(p[t] == 0) {
            if(b[i] != b[i + 1]) ans++;
            for(int j = 1; t * j <= 1000000; j++) {
                p[t * j] = 1;
            }
        }
    }
    printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 9284
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nuintptr)
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const int MAX= 1e6+10;
const ll inf =9;

ll vis[MAX],ans[MAX];
vi adj[MAX];
ll dfs(ll x){
	vis[x]=1;	
	ll c=0;
	queue<ll> q;
	q.push(x);
	while(!q.empty()){
		ll u=q.front();q.pop();
		c++;
		f(i,0,adj[u].size()){
			ll v=adj[u][i];
			if(vis[v]) continue;
			vis[v]=1;
			ans[v]=u;
			q.push(v);
		}
	}
	return c;
} 

int main(){
	fastio;
	ll tc,n,a,b,h,m;
	cin>>n>>m;
	f(i,0,m){
		cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	ll x=dfs(1);
	if(x==n){
		cout<<"Yes\n";
		f(i,2,n+1) cout<<ans[i]<<endl;
	}
	else cout<<"No\n";
}

Measured memory_bytes: 34876
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    cin >> n >> s;
    int l[n];
    int r[n];
    l[0] = r[0] = 0;
    if(s[0] == '(')r[0] = 1;
    if(s[0] == ')')l[0] = 1;
    int nl,nr;
    nr = l[0];
    for(int i = 1;i < n;i++){
        if(s[i] == ')')l[i] = l[i-1] + 1;
        else l[i] = l[i-1];
        if(s[i] == '(')r[i] = r[i-1] + 1;
        else r[i] = r[i-1];
        if(l[i] > r[i] + nr)nr++;
    }
    l[n-1] = r[n-1] = 0;
    if(s[n-1] == '(')r[n-1] = 1;
    if(s[n-1] == ')')l[n-1] = 1;
    nl = r[n-1]; 
    for(int i = 1;i < n;i++){
        if(s[n-1-i] == ')')l[n-1-i] = l[n-i] + 1;
        else l[n-1-i] = l[n-i];
        if(s[n-1-i] == '(')r[n-1-i] = r[n-i] + 1;
        else r[n-1-i] = r[n-i];
        if(r[n-1-i] > l[n-1-i] + nl)nl++;
    }
    for(int i = 0;i < nr;i++){
        cout << "(";
    }
    cout << s;
    for(int i = 0;i < nl;i++){
        cout << ")";
    }
}

Measured memory_bytes: 256
/******************************************************************************
 
рассвет. 
 
*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define all(a) (a).begin(),(a).end()
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (int i = a; i < (n); ++i)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
 
const lli MOD=1e9+7;
const lli MAXN=2e6;
const ld PI=acos(-1);

int main(){
    rapgame
    //freopen("brokeday.in", "r", stdin);
    //freopen("richday.out", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--){
        read2(h,w);
        read(k);
        char a[h][w];
        int sum=0;
        fr(i,h) fr(j,w) cin >> a[i][j];
        int w1=(1<<w)-1,h1=(1<<(h+w))-1-w1,ans=(k==0);
        fr(s,1<<(h+w)){
            vb rap(h+w,0);
            int x=s|h1,y=s|w1;
            if(x==s || y==s) continue;
            fr(i,h+w){
                rap[i]=((1<<(i))&s)>0;
            }
            int count=0;
            fr(i,h){
                fr(j,w){
                    if(a[i][j]=='#' && !rap[j] && !rap[i+w]) count++; 
                }
            }
            ans+=(count==k);
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3664
import java.util.*;

public class Main {
	public static void main(String[] args) {
      Scanner sc =new Scanner(System.in);
      int D = sc.nextInt();
      if (D == 25) {
        System.out.println("Christmas");
      } 
      if (D == 24) {
        System.out.println("Christmas Eve");
      } 
      if (D == 23) {
        System.out.println("Christmas Eve Eve");
      }
      if (D == 22) {
        System.out.println("Christmas Eve Eve Eve");
      } 
    }
}

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

int main() { 

    long N, M; cin >> N >> M;
    long res = 1;

    for(long i = 1; i * i <= M; i++){
      if (M % i != 0) continue;
      if (N * i <= M) res = max(res,i);
      if (N * (M / i) <= M) res = max(res,(M / i));                            
    }               
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;

int main(){
    iosetup;
    ll H; cin >> H;
    ll cnt = 0, k = 0;
    while(H > 0){
        cnt += 1LL << k;
        H /= 2;
        k++;
    }
    cout << cnt << endl;
    return 0;
}

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

int main()
{
    int64_t k;
    cin >> k;

    int64_t n = 50;

    int64_t d = k / n;
    int64_t m = k % n;

    cout << n << endl;

    for (int64_t i = 0; i < n; i++) {
        int64_t b = i < m ? n : (n - 1 - m);
        if (i > 0)
            cout << " ";
        cout << b + d;
    }
    cout << endl;

    return 0;
}


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

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

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

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

  vector<vector<char>> data(H + 2, vector<char>(W + 2, '#'));

  for (int i = 0; i < H; i++) {
    string S;
    cin >> S;
    for (int j = 0; j < W; j++) {
      data.at(i + 1).at(j + 1) = S.at(j);
    }
  }

  for (int i = 0; i < data.size(); i++) {
    for (int j = 0; j < data.at(i).size(); j++) {
      cout << data.at(i).at(j);
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int main(){
  vi a(3);
  rep(i,3)cin>>a[i];
  sort(rng(a));
  cout<<a[0]+a[1]<<endl;
}

Measured memory_bytes: 256
n = int(input())

w = list(map(int, input().split()))

sum = 0

for v in w:
    sum += v

w.reverse()

tmp = sum
t = []

for v in w:
    tmp -= 2*v
    t.append(tmp)
    if tmp < 0:
        break

if abs(t[-2]) < abs(t[-1]):
    print(abs(t[-2]))
else:
    print(abs(t[-1]))

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

int main(){
    int N;
    cin >> N;
    string s, t;
    cin >> s;
    cin >> t;
    long int ans = 1;
    long int mod = 1000000007;
    bool pre = true; //trueで縦
    for (int i = 0; i < N; i++) {
        if (i == 0){
            if (s[0] == t[0]) ans = 3;
            else {
                ans = 6;
                i++;
                pre = false;
            }
            continue;
        }
        if (pre) {
            if (s[i] == t[i]) {
                ans *= 2;
                pre = true;
            }
            else {
                ans *= 2;
                i++;
                pre = false;
            }
            ans %= mod;
        }
        else {
            if (s[i] == t[i]) {
                pre = true;
            }
            else {
                ans *= 3;
                i++;
                pre = false;
            }
            ans %= mod;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
L=list(input())
N=len(L)
R=N//2
for i in range(R):
  if L[i]!=L[N-1-i]:
    print("No")
    sys.exit()
  elif L[i]!=L[R-1-i]:
    print("No")
    sys.exit()
print("Yes")

Measured memory_bytes: 3060
import sys
import heapq
from collections import defaultdict
input = sys.stdin.readline

n, m = map(int, input().split())
dic = defaultdict(list)
total = 0
candidates = []
heapq.heapify(candidates)

for i in range(n):
    a, b = map(int, input().split())
    dic[a].append(b)

for day in range(1, m+1):
    if day in dic:
        for x in dic[day]:
            heapq.heappush(candidates, -x)

    if candidates:
        total -= heapq.heappop(candidates)

print(total)

Measured memory_bytes: 27588
import math
import numpy as np

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

def inv(x, mod):
    return pow(x, mod-2, mod)

class combination:
    def __init__(self, n, mod = 10**9 + 7):
        self.MOD = mod
        self.to = np.ones(n,dtype=np.int64)
        self.rev = np.ones(n,dtype=np.int64)
        for i in range(1, n):
            self.to[i] = self.to[i-1] * i % mod
        self.rev[-1] = inv(int(self.to[-1]),mod)
        for i in range(n-1, 0, -1):
            self.rev[i-1] = self.rev[i] * i % mod
    
    def nCk(self, n ,k):
        return self.to[n] * self.rev[k] % self.MOD * self.rev[n-k] % self.MOD

MOD = 998244353

n,m,k = NextInts()

cob = combination(200200, MOD)
ans = 0

x = pow(m-1, n-k-1) * m % MOD
for i in range(k+1):
    ans += x * cob.nCk(n-1, k-i)
    ans %= MOD
    x *= m-1
    x %= MOD

print(ans)

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    if (H > W) {
        cout << (N - 1 + H) / H << endl;
    } else {
        cout << (N - 1 + W) / W << endl;
    }
    return (0);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

double dist (double a, double b,  double c, double d){
    
    return sqrt((a-c)*(a-c) + (b-d)*(b-d));
    
}

bool check(int x,int y,vector<string> a,vector<string> b ){
    for(auto i = 0; i<b.size();i++){
        for(auto j =0; j<b.size();j++){
            if(a[x+i][y+j]!= b[i][j]) return false;
        }
    }
    return true;
}

int dist(pii a, pii b){
    return abs(a.first-b.first) + abs(a.second-b.second);
}


int main() {
    string s; cin>>s;
    for(auto i = 0; 2*i<s.size();i++){
        cout << s[2*i];
    }
    cout<<endl;
    return 0;
}







Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<cmath>

using namespace std;

int fie[50][50];
int r,n;
double px[4]={0,0,1,1};
double py[4]={0,1,0,1};

bool C(double t){
	double sx=20.0,sy=(double)-r+t;
	for(int i=20.0-r;i<=20+r;i++){
		for(int j=0;j<50;j++){
			if(fie[i][j]==0){
				for(int k=0;k<4;k++){
					double x=(double)i+px[k],y=(double)j+py[k];
					double dr=sqrt(pow(sx-x,2)+pow(sy-y,2));
					if(dr<(double)r)return false;
				}
			}
		}
	}
	return true;
}

int main(void){
	while(1){
		scanf("%d%d",&r,&n);
		if(r+n==0)break;
		memset(fie,0,sizeof(fie));
		for(int i=0;i<n;i++){
			int xl,xr,h;
			scanf("%d %d %d",&xl,&xr,&h);
			xl+=20,xr+=20;
			for(int i=xl;i<xr;i++){
				for(int j=0;j<h;j++)fie[i][j]=1;
			}
		}
		double resl=0.00,resr=50.00;
		for(int i=0;i<100;i++){
			double mid=(resl+resr)/2;
			if(C(mid))resl=mid;
			else resr=mid;
		}
		printf("%.7f\n",resr);
	}
	return 0;
}

Measured memory_bytes: 1080
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 0;

    for(int i=1 ; i<=n ; i+=2){
      int count = 1;
      for(int j=1 ; j<i ; j++){
        if(i%j==0){
          count++;
        }
      }
      // System.out.println(count);
      if(count==8){
        ans++;
      }
    }
    System.out.println(ans);
  }
}


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

int main() {
    double n, k;
    cin >> n >> k;
    
    double ans = 0;
    for(double i = 1; i <= n; ++i) {
        double res = 1 / n;
        int score = i;
        while(score < k) {
            score *= 2;
            res /= 2;
        }
        ans += res;
    }
    
    printf("%.12f\n", ans);
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

typedef pair<int, int> P;

P f(int x) {
    int a = x % 10;
    int b = 0;
    while (x) {
        b = x;
        x /= 10;
    }
    return P(a, b);
}

int main() {
    int N;
    cin >> N;
    map<P, int> freq;
    for (int i = 1; i <= N; i++) {
        P p = f(i);
        freq[p]++;
    }

    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        P p = f(i);
        P q(p.second, p.first);
        ans += freq[q];
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
int main()
{
  int n,x;
  long int sum=0;
  cin>>n>>x;
  vector<int> a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a.at(i);
    sum+=a.at(i);
  }

  int ans=0;
  if(sum==x) ans=n;
  else if(sum<x) ans=n-1;
  else
  {
    sort(a.begin(),a.end());
    int i=0;
    while(x>=0)
    {
      if((x-a.at(i))>=0)
      {
        ans++;
        x-=a.at(i);
        i++;
      }
      else break;
    }
  }

  cout<<ans<<endl;


}


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

class Program {
    static void Main(string[] args) {
        //入力
        string s = Console.ReadLine();
        int A = int.Parse(s.Split(' ')[0]);
        int B = int.Parse(s.Split(' ')[1]);
        int C = int.Parse(s.Split(' ')[2]);


        //計算
        if (A < C && C < B) {
            Console.WriteLine("Yes");
        } else if (B < C && C < A) {
            Console.WriteLine("Yes");
        } else
        {
            Console.WriteLine("No");
        }


        //出力




    }
}

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

using namespace std;
using ll = long long int;
using ullong = unsigned long long;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define int ll
int INF = 1e9;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
typedef pair<int, int> Vec2;
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


int dp[110][10100];

signed main() {
	ios::sync_with_stdio(false);
	int n;
	string s = "";
	cin >> n;
	cin >> s;
	rep(i, s.size()) {
		if (s[i] + n > 'Z') {
			s[i] += (n - 26);
		}
		else {
			s[i] += n;
		}
	}
	cout << s << endl;
	return 0;
}


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 = sc.nextInt();
        int result = n;
        int m = sc.nextInt();

        int min = sc.nextInt();
        int max = sc.nextInt();
        for(int i = 1; i < m; i++){
            int l = sc.nextInt();
            int r = sc.nextInt();
            if(l > min){
                min = l;
            }
            if(r < max){
                max = r;
            }
        }

        result -= (min - 1);
        if(n > max){
            result -= (n - max);
        }
        if(result < 0){
            System.out.println(0);
        }else{
            System.out.println(result);
        }
    }
}


Measured memory_bytes: 62220
/*
  Merge Sort
   ALDS1-ALDS1_5-B
  Recursion / Divide and Conquer - Merge Sort
*/
#include <iostream>
#include <vector>

using namespace std;

int n, comparision;
const int INF = 1e9;

void Merge(vector<int> &data, int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    vector<int> L(n1 + 1), R(n2 + 1);

    for (int i = 0; i < n1; ++i)
        L[i] = data[left + i];
    for (int i = 0; i < n2; ++i)
        R[i] = data[mid + i];
    L[n1] = INF;
    R[n2] = INF;

    int i = 0, j = 0;
    for (int k = left; k < right; ++k) {
        comparision++;
        if (L[i] <= R[j])
            data[k] = L[i++];
        else
            data[k] = R[j++];
    }
}

void MergeSort(vector<int> &data, int left, int right)
{
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        MergeSort(data, left, mid);
        MergeSort(data, mid, right);
        Merge(data, left, mid, right);
    }
}

int main()
{
    // Input
    cin >> n;
    vector<int> data(n);
    for (int i = 0; i < n; ++i)
        cin >> data[i];
    comparision = 0;

    // Algorithm
    MergeSort(data, 0, n);

    // Output
    for (int i = 0; i < n; ++i)
        cout << data[i] << ((i == n - 1) ? '\n' : ' ');
    cout << comparision << endl;

    return 0;
}

Measured memory_bytes: 5060
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define MAX 100005
#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;



void solve(){
    ll n;
    cin>>n;
    vector<ll> v(n+1,2);
    ll ans=1;
    v[1]=1;
    for(ll i=2;i<=n;i++){
        for(ll j=2*i;j<=n;j+=i){
            v[j]++;
            
        }
    }
    for(ll i=2;i<=n;i++){
        ans+=(i*v[i]);
        //cout<<v[i]<<" ";
    }
    cout<<ans<<"\n";
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;

    int t=1;
    //cin>>t;
    while(t--){
        solve();   
    }

    return 0;
    
}

Measured memory_bytes: 81320
#include <stdio.h>
long long arr[55];
int main()
{
	int n, i=0;
	long long ans = 0;
	scanf("%d", &n);
	while (n--)
	{
		i++;
		scanf("%lld", &arr[i]);
	}
	for (int j=1; j<=i-1; j++)
		for (int m = j + 1; m <= i; m++)
		{
			ans += arr[j] * arr[m];
		}
	printf("%lld\n", ans);
	return 0;
}

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

class DisjointSet {
    public:
        vector<int> rank, p;
    
    DisjointSet() {}
    DisjointSet(int size) {
        rank.resize(size, 0);
        p.resize(size, 0);
        for (int i = 0; i < size; i++) makeSet(i);
    }

    void makeSet(int x) {
        p[x] = x;
        rank[x] = 0;
    }

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

    void unite(int x, int y) {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y) {
        if (rank[x] > rank[y]) {
            p[y] = x;
        } else {
            p[x] = y;
            if (rank[x] == rank[y]) rank[y]++;
        }
    }

    int findSet(int x) {
        if (x != p[x]) {
            p[x] = findSet(p[x]);
        }
        return p[x];
    }
};

int main() {
    int N, K, L;
    scanf("%d %d %d", &N, &K, &L);
    DisjointSet ds_p = DisjointSet(N);
    DisjointSet ds_r = DisjointSet(N);
    int p, q, r, s;
    for (int i = 0; i < K; i++) {
        scanf("%d %d", &p, &q);
        p--;
        q--;
        ds_p.unite(p, q);
    }
    for (int i = 0; i < L; i++) {
        scanf("%d %d", &r, &s);
        r--;
        s--;
        ds_r.unite(r, s);
    }
    map<pair<int, int>, int> mp;
    for (int i = 0; i < N; i++) {
        mp[make_pair(ds_p.findSet(i), ds_r.findSet(i))]++;
    }
    for (int i = 0; i < N; i++) {
        printf("%d ", mp[make_pair(ds_p.findSet(i), ds_r.findSet(i))]);
    }
    printf("\n");
    return 0;
}

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

int main() {
    int n;
    cin>>n;
    int i=1;
    while(1){
        if(i*i>n) {
            cout<<(i-1)*(i-1)<<endl;
            return 0;
        }
        i++;
    }
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var N = Number(line[0]);
	var S = line[1].split(" ");
	var ans = "Three"
  	for(var i = 0; i < N; i++){
    	if(S[i] === "Y") ans ="Four";
    }
	console.log(ans);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <list>
#include <stack>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1LL << 50;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
 
struct edge{
    int from, to; ll cost;
};

int main(){
    int n, ans = 1;
    cin >> n;
    int flag = 0; // true - + // false - -
    ll b = 0;
    REP(i, n){
        ll tmp;
        cin >> tmp;
        if(flag == 0){
            b = tmp;
            flag = 2;
            continue;
        }
        if(flag == 2){
            if(tmp == b){
                continue;
            }else if(tmp > b){
                flag = 1;
                b = tmp;
            }else{
                flag = -1;
                b = tmp;
            }
        }
        if(tmp >= b && flag == 1){
            b = tmp;
        }else if(tmp <= b && flag == -1){
            b = tmp;
        }else{
            ans++;
            b = tmp;
            flag = 2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する


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

    ll N, K;
    cin >> N >> K;

    ll ans = 0ll;
    rep(b, 1, N + 1) {
        ll tmp = (N / b) * max(b - K, 0ll);
        if (N % b > 0)tmp += max(N % b - max(K, 1ll) + 1, 0ll);

        ans += tmp;
    }

    cout << ans << endl;

    return 0;
}


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

int a[10] = {0,1,2,3,4,5,6,7,8,9}, N, S;

int part(int index, int sum, int elem){
	if (sum > S || elem > N) return 0;
	if (sum == S && elem == N) return 1;
	if (index >= 10) return 0;
	return part(index + 1, sum + a[index], elem + 1) + part(index+1, sum, elem);
}

int main(){
	while (cin >> N >> S)
	{
		if (!N && !S) break;
		cout << part(0,0,0) << endl;
	}
	return 0;
}

Measured memory_bytes: 2988
#include <iostream>
using namespace std;
static int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main()
{
  int K;
  cin >> K;
  long long ans = 0;
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j <= K; j++) {
      for (int k = 1; k <= K; k++) {
        ans += gcd(i, gcd(j, k));
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3596
from collections import deque, defaultdict
N, M = map(int, input().split())
D = defaultdict(list)
for i in range(M):
    s, t = map(int, input().split())
    D[s].append(t)
    D[t].append(s)
    
q = deque()
q.append(1)
d = defaultdict(lambda: float("inf"))
d[1] = 0

while q:
  u = q.popleft()
  
  for v in D[u]:
    if d[v] == float("inf"):
      d[v] = u
      q.append(v)
      
if len(d) == N:
  print("Yes")
else:
  print("No")
  exit()
  
for i in range(2, N+1):
  print(d[i])

Measured memory_bytes: 47476
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s, t;
  cin>>s>>t;
  int dp[s.size() + 1][t.size() + 1];
  for(int i=0; i<=s.size(); i++){
    for(int j=0; j<=t.size(); j++){
      if(i == 0 || j == 0){
        dp[i][j] = 0;
        continue;
      }
      if(s[i-1] == t[j-1]) dp[i][j] = dp[i-1][j-1] + 1;
      else
         dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
    }
  }
  string ans = "";
  for(int i=s.size(), j = t.size(); i>0 && j>0; ){
    if(s[i-1] == t[j-1]){
    //if(dp[i][j] != max(dp[i-1][j], dp[i][j-1])) {
      ans += s[i-1];
      i--, j--;
      continue;
    }
    if(dp[i][j] == dp[i-1][j]){
      i--;
      continue;
    }
    else{
      j--;
      continue;
    }
  }
  //cout<<dp[s.size()][t.size()];
  reverse(ans.begin(), ans.end());
  cout<<ans;
  return 0;
}

 
        	


Measured memory_bytes: 35456
n, k = gets.split.map &:to_i
a = gets.split.map &:to_i
x = {}
a.each{|i|x[i] = x[i].to_i + 1}
x = x.sort{|a, b| a[1] <=> b[1]}
ans = 0
l = x.size
x[0, l-k].each{|i,c|ans += c} if l >= k
p ans

Measured memory_bytes: 40944
H,W = map(int,input().split())
 
h = []
w_tmp = [0 for i in range(W)]
A =[]
for i in range(H):
  a = input()
  A.append(a)
  if "#" in a:
    h.append(i)
  for j in range(W):
    if a[j] == "#":
      w_tmp[j]+=1
w =[]
for j in range(W):
  if w_tmp[j] > 0:
    w.append(j)
for i in h:
  for j in w:
    print(A[i][j],end="")
  print("")

Measured memory_bytes: 4468
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
  ll mini=INF;
 for(ll i=0;i<=N;i++){
   ll ans=0;
   ll main=i;
   ll rest=N-main;
   while(main>=6){
     ans+=main%6;
     main/=6;
   }
   ans+=main;
   while(rest>=9){
     ans+=rest%9;
     rest/=9;
   }
   ans+=rest;
   
   mini=min(ans,mini);
 }
  
  cout<<mini<<endl;
}
   


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
        System.out.println(process(readAll(System.in)));
    }

    protected static String process(String data) {
        final String[] lines = splitForLines(data);

        StringBuilder sb = new StringBuilder();

        for (String line : lines) {
            final int[] split = split(line);

            int height = split[0];
            int width = split[1];

            if (height == 0 && width == 0) {
                break;
            }

            if (sb.length() > 0) {
                sb.append("\n");
            }

            sb.append(rectangle(width, height));
        }

        return sb.toString();
    }

    static String rectangle(int width, int height) {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < height; i++) {
            for (int j = 0; j < width; j++) {
                sb.append('#');
            }
            sb.append('\n');
        }

        return sb.toString();
    }

    private static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    }

    private static String[] splitForLines(String lines) {
        return lines.split("\\n");
    }

}

Measured memory_bytes: 21016