akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <map>
#include <unordered_set>
#include <tuple>
#include <queue>
#include <set>
#include <cstring>
#include <functional>
#include <random>
#include <chrono>

#define ar array
#define all(arr) (arr).begin(), (arr).end()
#define range(i, n) for (int i=0; i < n; ++i)
#define rall(arr) (arr).rbegin(), (arr).rend()

typedef long long ll;
typedef long double ld;

using namespace std;

const ll INF = 1e18;
const int INFi = 2e9;
const int maxN = 1e6 + 5;
const int md = 998244353;
const int md2 = 1e9 + 7;

double getTime() { return clock() / (double) CLOCKS_PER_SEC; };

struct seg_tree {
    struct Node {
        int val = INFi;
    };

    vector<Node> tree{};
    int n{};

    void build(int k) {
        n = k;
        tree.resize(n * 4);
    }

    void upd(int v, int l, int r, int lq, int rq, int x) {
        if (lq >= r || l >= rq) return;
        if (lq <= l && r <= rq) {
            tree[v].val = min(x, tree[v].val);
            return;
        }
        upd(v<<1, l, (l+r)>>1, lq, rq, x);
        upd((v<<1)+1, (l+r)>>1, r, lq, rq, x);
    }

    int get(int v, int l, int r, int pos) {
        if (pos >= r || pos < l) return INFi;
        if (l + 1 == r) {
            return tree[v].val;
        }
        return min(min(get(v<<1, l, (l+r)>>1, pos), get((v<<1)+1, (l+r)>>1, r, pos)), tree[v].val);
    }

    void upd(int lq, int rq, int x) {
        upd(1, 0, n, lq, rq, x);
    }

    int get(int pos) {
        return get(1, 0, n, pos);
    }
};

void solve() {
    int n, q; cin >> n >> q;
    seg_tree cols, rows;
    cols.build(n + 5);
    rows.build(n + 5);
    vector<int> cu(n), ru(n+1);
    ll ans = 1ll * (n - 2) * (n - 2);
    range(_, q) {
        int t, x; cin >> t >> x;
        if (t == 1) {
            if (cu[x]) continue;
            int e = rows.get(x);
            e = min(e, n);
            cols.upd(1, e, x);
            ans -= e - 2;
            cu[x] = 1;
        } else {
            if (ru[x]) continue;
            int e = cols.get(x);
            e = min(e, n);
            rows.upd(1, e, x);
            ans -= e - 2;
            ru[x] = 1;
        }
    }
    cout << ans << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //cout << setprecision(15) << fixed;
    int tests = 1;
    //cin >> tests;
    range(_, tests) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 11116
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5 ;
int p[N],n ;
int rnk[N];
vector < pair < int , pair < int , int > > > v;
int parent(int x){
   if(p[x] == x)
       return x;
   return p[x] = parent(p[x]);
}
bool isConnected(int x , int y){
   return parent(x) == parent(y);
}
void connect(int x , int y){
   if(isConnected(x,y))
       return;
   int pOfx = parent(x);
   int pOfy = parent(y);
   if(rnk[pOfx] > rnk[pOfy]){
       p[pOfy] = pOfx;
   }else if(rnk[pOfy] > rnk[pOfx]){
       p[pOfx] = pOfy;
   }else{
       p[pOfy] = pOfx;
       rnk[pOfx]++;
   }
}
void preDSU(){
   for(int i = 0;i<N;i++){
       p[i] = i;
   }
}

int main(){
    preDSU();
    scanf("%d",&n);
    vector < pair < int ,int > > v1, v2;
    for(int i = 1 ; i <= n ; i++){
        int x,  y;
        scanf("%d%d",&x,&y);
        v1.push_back({x,i});
        v2.push_back({y,i});
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    for(int i = 1 ; i < n ; i++){
        v.push_back({v1[i].first - v1[i - 1].first,{v1[i].second,v1[i - 1].second}});
        v.push_back({v2[i].first - v2[i - 1].first,{v2[i].second,v2[i - 1].second}});
    }
    sort(v.begin(),v.end());
    long long ans = 0 ;
    for(int i = 0 ; i < v.size() ; i++){
        int x = v[i].second.first;
        int y = v[i].second.second;
        long long cost = v[i].first;
        if (isConnected(x, y))
            continue;
        connect(x,y);
        ans += cost;
    }
    cout << ans;
    return 0;
}


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

#define N_Max 200001
#define A_Max 1000001
using namespace std;
const long long INF = 1LL <<60;

int main(void){
  long long x,n,nn,tmp;
  long long res=0;
  int a[N_Max];
  int count[A_Max]={};
  int dp[A_Max]={};
  long long i,j,k;
  long long flg=0;
  
  cin>>n;
  nn=0;
  k=0;
  
  
  for(i=0;i<n;i++){
    cin>>tmp;
    if(count[tmp]==0){
      a[k]=tmp;
      k++;
      nn++;
      count[tmp]=1;
      for(j=tmp*2;j<A_Max;j=j+tmp){
        dp[j]=1;
      }
    }
    else{
      count[tmp]=2;
      dp[tmp]=1;
    }
  }
    
  for(i=0;i<nn;i++){
    if(dp[a[i]]==0){
      res++;
      //cout<<a[i]<<endl;
    }
  }  

  cout<<res<<endl;
      
  
  return 0;
  
}      

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

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


Measured memory_bytes: 1024
#include <stdio.h>
#define MAX 100
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];

void dijkstra()
{
  int minv;
  int d[MAX],color[MAX];
  for(int i=0;i<n;i++)
    {
      d[i]=INFTY;
      color[i]=WHITE;
    }
  d[0]=0;
  color[0]=GRAY;
  while(1)
    {
      minv=INFTY;
      int u=-1;
      for(int i=0;i<n;i++)
	{
	  if(minv>d[i]&&color[i]!=BLACK)
	    {
	      u=i;
	      minv=d[i];
	    }
	}
      if(u==-1)break;
      color[u]=BLACK;
      for(int v=0;v<n;v++)
	{
	  if(color[v]!=BLACK&&M[u][v]!=INFTY)
	    {
	      if(d[v]>d[u]+M[u][v])
		{
		  d[v]=d[u]+M[u][v];
		  color[v]=GRAY;
		}
	    }
	}
    }
  for(int i=0;i<n;i++)
    {
      printf("%d %d\n",i,(d[i]==INFTY ? -1:d[i]));
    }
}

int main()
{
  scanf("%d",&n);
  for(int i=0;i<n;i++)
    {
      for(int j=0;j<n;j++)
	{
	  M[i][j]=INFTY;
	}
    }
  int k,c,u,v;
  for(int i=0;i<n;i++)
    {
      scanf("%d%d",&u,&k);
      for(int j=0;j<k;j++)
	{
	  scanf("%d%d",&v,&c);
	  M[u][v]=c;
	}
    }
  dijkstra();
  return 0;
}



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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = x * 10 + (c ^ 48), c = nc;
  return x;
  #undef nc
}

typedef long long ll;
typedef pair <int, int> pii;
const int maxn = 2020;
int n, A[maxn * 3];

int tag, val[maxn], dp[maxn][maxn];

void solve() {
  cin>>n;
  rep(i,1,3*n){
    A[i]=read();
  }
  if(n==1){
    puts(A[1]==A[2]&&A[2]==A[3]?"1":"0");
    return;
  }
  int mx=0;
  memset(dp,-0x3f,sizeof dp);
  memset(val,-0x3f,sizeof val);
  rep(x,1,5)rep(y,1,5)if(x!=y){
    int flg=1;
    int lst=-1;
    rep(i,1,5)if(i!=x&&i!=y)flg&=lst==-1||A[i]==lst,lst=A[i];
    dp[A[x]][A[y]]=flg;
    dp[A[y]][A[x]]=flg;
    chkmax(mx,flg),chkmax(val[A[x]],flg),chkmax(val[A[y]],flg);
  }
  rep(T, 2, n - 1) {
//    puts("-----");
//    rep(i,1,n)rep(j,1,n)printf("(%d %d) %d\n",i,j,dp[i][j]<0?-1:dp[i][j]);
    int ttt = 3 * (T - 1) + 2;
    int x = A[ttt + 1];
    int y = A[ttt + 2];
    int z = A[ttt + 3];
    if (x == y && y == z) {
      tag++;
      continue;
    }
    if(y==z)swap(x,z);
    if(x==z)swap(y,z);
    static int tmp[maxn];
    if(x==y){
      rep(i,1,n)tmp[i]=dp[i][x];
    }
    int orz=0;
    int v1=max(mx,dp[z][z]+1);
    int v2=max(mx,dp[y][y]+1);
    int v3=max(mx,dp[x][x]+1);
    rep(i,1,n){
      chkmax(orz,val[i]);
      chkmax(dp[i][x],val[i]);
      chkmax(dp[x][i],val[i]);
      chkmax(dp[i][y],val[i]);
      chkmax(dp[y][i],val[i]);
      chkmax(dp[i][z],val[i]);
      chkmax(dp[z][i],val[i]);
      if(x==y){
        chkmax(dp[i][z],tmp[i]+1);
        chkmax(dp[z][i],tmp[i]+1);
      }
    }
    chkmax(dp[x][y],v1);
    chkmax(dp[y][x],v1);
    chkmax(dp[x][z],v2);
    chkmax(dp[z][x],v2);
    chkmax(dp[y][z],v3);
    chkmax(dp[z][y],v3);
    if(x==y)rep(i,1,n){
      chkmax(val[z],tmp[i]+1),chkmax(val[i],tmp[i]+1),chkmax(mx,tmp[i]+1);
    }
    chkmax(val[x],max(orz,max(v1,v2)));
    chkmax(val[y],max(orz,max(v1,v3)));
    chkmax(val[z],max(orz,max(v2,v3)));
    chkmax(mx,max(val[x],max(val[y],val[z])));
  }
//  puts("-----");
//  rep(i,1,n)rep(j,1,n)printf("(%d %d) %d\n",i,j,dp[i][j]<0?-1:dp[i][j]); puts("");
  int res=0;
  rep(x,1,n)rep(y,1,n){
    chkmax(res,dp[x][y]+(x==y&&A[3*n]==x));
  }
  cout<<res+tag<<endl;
}

signed main() {
//  int T = read();
//  while (T--) solve();
  solve();
  return 0;
}

Measured memory_bytes: 19632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    int n,m;cin>>n>>m;
    vector<int> a(n,-1);
    bool ok = true;
    rep(i,m){
        int tmp;cin>>tmp;
        int c;cin>>c;
        if(a[tmp-1]!=-1 && a[tmp-1] != c)  {
            ok = false;
            break;
        }
        else a[tmp-1] = c;
    }

    if(n != 1 && a[0] == -1 ) a[0] = 1;
    else if(n == 1&& a[0] == -1) a[0] = 0;
    if(n != 1 && a[0] == 0) ok = false;

    rep(i,n){
        if(a[i] == -1) a[i] =0;
    }
    int ans = 0;
    int mul = 0;
    if(ok){
        rep(i,n){
            cout << a[i];
        }
        cout << endl;

    }else{
        cout <<"-1"<<endl;
    }


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >

int power(int a,int b,int p)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    fast;
    int n,r=0,b=0;
    string str;
    cin>>n>>str;
    rep(i,n)
    {
        if(str[i]=='R')
            r++;
        else
            b++;
    }
    if(r>b)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

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

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long T = scan.nextLong();
        List<Pair> zero_list = new ArrayList<>();
        List<Pair> non_zero_list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            long a = scan.nextLong();
            long b = scan.nextLong();
            Pair p = new Pair(a, b);
            if (a == 0) {
                zero_list.add(p);
            } else {
                non_zero_list.add(p);
            }
        }

        zero_list.sort(new ZeroPairComparator());
        long[] z = new long[zero_list.size()+1];
        for (int i = 0; i < zero_list.size(); i++) {
            z[i + 1] = Math.min(z[i] + zero_list.get(i).b + 1, T + 1);
        }
        TreeMap<Long, Integer> zero_tree = new TreeMap<>();
        for (int i = 0; i < z.length; i++) {
            zero_tree.put(z[i], i);
        }

        non_zero_list.sort(new NonZeroPairComparator());
        long[] dp = new long[41];
        Arrays.fill(dp, T+1);
        dp[0] = 0;
        int len = non_zero_list.size();
        for (int i = 0; i < len; i++) {
            Pair p = non_zero_list.get(i);
            for (int j = 40; 0 <= j; j--) {
                if ( T < dp[j]) {
                    continue;
                }
                long time = dp[j] + 1 + p.a * (dp[j] + 1) + p.b;
                dp[j+1] = Math.min(dp[j+1], time);
            }
        }
        long ans = 0;
        for (int i = 0; i <= 40; i++) {
            if (T < dp[i]) {
                continue;
            }
            long count = i;
            long x = zero_tree.floorKey(T - dp[i]);
            ans = Math.max(ans, count + zero_tree.get(x));
        }
        System.out.println(ans);
    }

    class Pair {
        long a;
        long b;
        Pair(long a, long b) {
            this.a = a;
            this.b = b;
        }
    }

    class ZeroPairComparator implements Comparator<Pair> {
        @Override
        public int compare(Pair o1, Pair o2) {
            return Long.compare(o1.b, o2.b);
        }
    }

    class NonZeroPairComparator implements Comparator<Pair> {
        @Override
        public int compare(Pair o1, Pair o2) {
            return -Long.compare(o1.a * (o2.b + 1), o2.a * (o1.b+1));
        }
    }
}


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

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<#a<<':'<<a<<endl

const ll INF = 1e9+7;

template<typename T>inline T digit(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  ll n;cin>>n;
  ll ans = (n / 11) * 2;
  if(n % 11 != 0){
    if(n%11 <= 6) ans++;
    else ans += 2;
  }
  print(ans);
  return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    ll N;
    cin >> N;
    vl H(N);
    for (auto &x : H) cin >> x;
    ll ans[N] = {};
    REP(i, 0, N - 1) {
        if (H[i] >= H[i + 1]) {
            ans[i] = ans[i + 1] + 1;
        }
    }
    cout << *max_element(ans, ans + N) << endl;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <map>
 
using namespace std;

typedef long long ll;

const ll MOD = 1e9+7;

inline long pow(long base, long exp)
{
    if (1 < exp) return base * pow(base, exp - 1) % MOD;
    else return base;
}
 
int main()
{
    long N;
    map<long, int> table;
    long A;
    bool isPossible = true;
 
    scanf("%ld", &N);
 
    long i;
 
    for (i = 0; i < N; i++) {
        scanf("%ld", &A);
 
        if (table.find(A) == table.end()) {
            if ((N % 2 == 0 && A % 2 == 0) || (N % 2 != 0 && A % 2 != 0)) {
                isPossible = false;
 
                break;
            }
 
            table[A] = 1;
        } else {
            table[A]++;
 
            if ((A == 0 && 1 < table[A]) || (A != 0 && 2 < table[A])) {
                isPossible = false;
 
                break;
            }
        }
    }
 
    if (!isPossible) {
        printf("0\n");
    } else {
        if (isPossible) {
            if (N == 1) {
                printf("1\n");
            } else {
                printf("%ld\n", pow(2, N / 2));
            }
        } else {
            printf("0\n");
        }
    }
 
    return 0;
}

Measured memory_bytes: 3456
#include <stdio.h>
#include<string.h>
void move(char *s,int n){
	char c=s[0];
	for(int i=0;i<n;i++)
		s[i]=s[i+1];
	s[n-1]=c;
}
int main(int argc, char *argv[])
{
	char s1[110],s2[110];
	scanf("%s",s1);
	scanf("%s",s2);
	int i,j;
	int la=strlen(s1);
	for(i=0;i<la;i++){
		move(s2,strlen(s2));
		if(strcmp(s2,s1)==0)
			break;
	}
	if(i==la)
		printf("No\n");
	else
		printf("Yes\n");	
	
	
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int L, N, X, W, T;
int main() {
	scanf("%d%d", &L, &N);
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &X, &W);
		T -= X * W;
	}
	if (T > 0) {
		printf("1\n");
		printf("1 %d\n", T);
	}
	else if (T < 0) {
		printf("1\n");
		printf("-1 %d\n", -T);
	}
	else {
		printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 2708
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
vector<long long> divisor(long long n){
    vector<long long> res;
    for(long long i = 1; i * i <= n; i++) {
        if(n%i==0){
            res.push_back(i);
            if (!(i * i == n)) res.push_back(n / i);
        }
    }
    return res;
}
int main() {
ll x;
cin >> x;
vector<ll> div = divisor(x);
for (ll i = -2000; i <= 2000;i++){
    for (ll j = -2000; j <= 2000;j++){
        if(i*i*i*i*i-j*j*j*j*j==x){
            cout << i << " " << j << endl;
            return 0;
        }
    }
}
}


Measured memory_bytes: 3632
# coding: utf-8
# Your code here!
for i in range(3):
    x=list(map(int,input().split()))
    x0=x[0]*3600+x[1]*60+x[2]
    x1=x[3]*3600+x[4]*60+x[5]
    
    h=(x1-x0)//3600
    m=((x1-x0)%3600)//60
    s=((x1-x0)%3600)%60
    
    print(h,m,s)


Measured memory_bytes: 5600
#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
 
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
#define pb(x) push_back(x)
#define FOR(k, n) for (int k = 0; k < n; k++)
#define FORN(k, s, n) for (int k = s; k < n; k++)
#define debug(x) printf("%s = %d\n", #x, x)
#define debug2(x, y) printf("%s = %d, %s = %d\n", #x, x, #y, y)
#define debug3(x, y, z) printf("%s = %d, %s = %d, %s = %d\n", #x, x, #y, y, #z, z)
#define debug4(x, y, z, t) printf("%s = %d, %s = %d, %s = %d, %s = %d\n", #x, x, #y, y, #z, z, #t, t)
 
#pragma warning(disable : 6031)
#pragma warning(disable : 4101)
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef complex<double> cd;
 
const int INF = 1e9;
const long long LINF = 1e18;
const double PI = acos(-1);
 
// Solution

const int MAXN = 100005;

int n;
pii A[MAXN];

int main() {
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%d", &A[i].X);
        A[i].Y = i + 1;
    }

    sort(A, A + n);

    for (int i = 0; i < n; i++) {
        printf("%d ", A[i].Y);
    }

    printf("\n");
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

ll N, M;

int main(){
	cin >> N >> M;
	
	vector<int> L(N), R(N);
	
	for ( int i = 0; i < M; i++ ){
		int l, r;
		cin >> l >> r;
		l--;
		r--;
		L[l]++;
		R[r]++;
	}
	
	int openable = 0;
	int ans = 0;
	for ( int i = 0; i < N; i++ ){
		openable += L[i];
		if ( openable == M )
			ans++;
		openable -= R[i];
	}
	
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 1024
import Control.Applicative
import Control.Monad

solver :: Int -> Int -> [Int]
solver n y =
    let xs = [(a, b) | a <- [0..n], b <- [0..(n-a)], 10000*a+5000*b+1000*(n-a-b) == y]
        in solver' xs n

solver' :: [(Int, Int)] -> Int -> [Int]
solver' []          _ = [-1, -1, -1]
solver' ((a, b):xs) n = [a, b, n-a-b]

main :: IO ()
main = do
    (n:y:_) <- (map read) . words <$> getLine
    putStrLn (unwords (map show (solver n y)))


Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const ll INF = 1e9+9, LINF = 1e18;


int main()
{
    bool a=1;
    char c;
    while(cin>>c){
        if(c=='C'&& a)a=0;
        if(c=='F'&&!a)yn(1),exit(0);
    }
    yn(0);
    return 0;
}


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

using namespace std;

#define fi first
#define se second
typedef pair<int, int> pi;
typedef long long ll;

int sub1(int n, int k)
{
    int wei[n], val[n];
    for (int i = 0; i < n; ++i)
        cin >> wei[i] >> val[i];

    ll best = 0;
    for (int i = 1; i < (1 << n); ++i)
    {
        ll v = 0, w = 0;
        for (int j = 0; j < n; ++j)
        {
            if (i & (1 << j))
            {
                if (w + wei[j] <= k)
                {
                    v += val[j];
                    w += wei[j];
                }
            }
        }
        best = max(best, v);
    }

    cout << best;
}

int sub2(int n, int k)
{
    int wei[n], val[n];
    for (int i = 0; i < n; ++i)
        cin >> wei[i] >> val[i];

    ll dp[n + 1][k + 1];
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j <= k; ++j)
        {
            if (i == 0)
                dp[0][j] = 0;
            else if (j >= wei[i - 1])
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - wei[i - 1]] + val[i - 1]);
            else
                dp[i][j] = dp[i - 1][j];
        }
    }
    cout << dp[n][k];
}

int main()
{
    if (fopen("Test.INP", "r"))
        freopen("Test.INP", "r", stdin);

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

    if (n <= 20)
        sub1(n, k);
    else
        sub2(n, k);
    return 0;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	double a, b, c;
	double d, e, f;
	while(cin >> a >> b >> c >> d >> e >> f){
		double x = (c * e - b * f) / (a * e - b * d);
		double y = (c * d - a * f) / (b * d - a * e);
		
		if(x == -0)
			x = 0;
		if(y == -0)
			y = 0;
		
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
	return 0;
}

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

int main(){
  int A,B,T; cin>>A>>B>>T;
  int ans=0;
  for(int i=A;i<=T;i+=A){
    ans+=B;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<vector>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*

 */
int H,W,h,w;

int main(){
  cin>>H>>W>>h>>w;
  cout<< H*W - (H*w + h*W - h*w) <<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
ll n,ch[100010];
vector<pair<ll,ll>>a[100010];
void dep(ll now,ll c){
	if(a[now].size()==1&&now!=0){
		return ;
	}
	ll cnt=1;
	for(ll i=0;i<a[now].size();i++){
		ll nexch=a[now][i].second;
		if(ch[nexch]!=0){
			continue;
		}
		if(cnt==c){
			cnt++;
		}
		ch[nexch]=cnt;
		ll nex=a[now][i].first;
		dep(nex,cnt);
		cnt++;
	}
}
int main() {
	cin>>n;
	ll ans=0;
	for(ll i=0;i<n-1;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		a[y].push_back(make_pair(x,i));
		a[x].push_back(make_pair(y,i));
		ans=max({ll(a[y].size()),ll(a[x].size()),ans});
	}
	cout <<ans<<endl;
	dep(0,0);
	for(ll i=0;i<n-1;i++){
		cout <<ch[i]<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 9856
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    int min=INT_MAX;
    for(int i=0;i<=v.size()-k;i++)
    {
        if(min>v[i+k-1]-v[i]){
            min=v[i+k-1]-v[i];
        }
    }
    cout<<min;
}

Measured memory_bytes: 3764
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	string a, b, c;
	cin >> a >> b >> c;
	if (a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0])
		cout << "YES" << "\n";
	else
		cout << "NO" << "\n";
}

Measured memory_bytes: 3632
//wait for sh
    #pragma GCC optimize("Ofast")
    #include <bits/stdc++.h>
    using namespace std;

    #define int long long int
    #define pb push_back
    #define mp make_pair
    #define loop(i,st,end) for(int i=st;i<end;i++)
    #define itr(it,v)  for(auto it=v.begin();it!=v.end();++it)
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define debug(x) cout << "[ " << #x  << " : " << x << " ]" << endl ;
    #define mod (int)(1e9+7)
    const int maxn=21;
    int dp[(1<<maxn)][maxn+1];
    int a[maxn][maxn];
    int n;

    int rec(int idx,int bmsk)
    { //cout<<idx<<endl;
      if(idx==n)
        return 1;

      if(dp[bmsk][idx]!=-1)
        return dp[bmsk][idx];

      int ans=0;
      for(int i=0;i<n;i++)
      {
        if(a[idx][i] and !(bmsk & (1<<i)))
            ans+=rec(idx+1,(bmsk|(1<<i)));

          

        ans%=mod;
      }

      dp[bmsk][idx]=ans;

      return ans;

    }

    void solve()
      {
        
        cin>>n;

        memset(dp,-1,sizeof(dp));

        loop(i,0,n)
        {
          loop(j,0,n)
           cin>>a[i][j];
        }

        cout<<rec(0,0)<<endl;
 
      }

    int32_t main()
    { IOS


      int t;
      t=1;
      //cin>>t;

      loop(i,0,t)
      {  //cout<<"Case #"<<(i+1)<<": ";
          solve();
      }

      return 0;
    }


Measured memory_bytes: 360704
#include<bits/stdc++.h>
#define int long long

using namespace std;

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

    int n, arr[20];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> arr[i];

    int cnt = 0;
    for (int i = 1; i < n - 1; i++)
        cnt += ((arr[i] > arr[i - 1] && arr[i] < arr[i + 1]) || (arr[i] < arr[i - 1] && arr[i] > arr[i + 1]));
    cout << cnt << '\n';

    return 0;
}


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

int main() {
    int64_t A, V, B, W, T;
    std::cin >> A >> V >> B >> W >> T;

    const int64_t dist = std::abs(A - B);
    const int64_t v = V - W;

    if ((v * T) >= (dist)) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3596
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      	int K = sc.nextInt();
        int[] check = new int[N];
        int counter = 0;
        
        for(int q=0; q<N; q++){
          check[q] = -1;
        }
      
      	for(int i=0; i<K; i++){
          int d = sc.nextInt();
            for(int j=0; j<d; j++){
              int a = sc.nextInt();
              check[a-1] = 0;
            }
        }
      
		for(int r=0; r<N; r++){
          if(check[r] == -1){
            counter++;
          }
        }
      
        System.out.println(counter);
    }
}


Measured memory_bytes: 46240
from collections import deque

def main():
    n,m = map(int,input().split())
    arr = [[] for i in range(n)]
    for _ in range(m):
        a,b = map(int,input().split())
        arr[a-1].append(b-1)
        arr[b-1].append(a-1)
    q = deque()
    q.append(0)
    ans = {i:0 for i in range(1, n)}
    while q:
        now = q.popleft()
        for i in arr[now]:
            if i == 0:
                continue
            if ans[i] == 0:
                ans[i] = now+1
                q.append(i)
        if len(q) == 0:
            break
    print('Yes')
    for i in range(1,n):
        print(ans[i])



if __name__=='__main__':
    main()


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

int count(const vector<string>& hws, int h, int w) {
  if(hws[h][w] == '#') {
    return -1;
  } else {
    int ans = 0;
    for(auto ay : {-1, 0, 1}) {
      for(auto ax : {-1, 0, 1}) {
        if(ay == 0 && ax == 0) {
          continue;
        }
        auto y = h + ay;
        auto x = w + ax;
        if(y < 0 || hws.size() <= y) {
          continue;
        }
        if(x < 0 || hws[y].size() <= x) {
          continue;
        }
        if(hws[y][x] == '#') {
          ans++;
        }
      }
    }
    return ans;
  }
}

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> hws(H);
  for(int i = 0; i < H; ++i) {
    cin >> hws[i];
  }
  for(int h = 0; h < H; ++h) {
    for(int w = 0; w < W; ++w) {
      if(hws[h][w] == '#') {
        cout << "#";
      } else {
        cout << count(hws, h, w);
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
open System

// prelude
let readStr () = stdin.ReadLine()

let read f () = readStr() |> f
let reads f () = readStr().Split() |> Array.map f

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let readPair f g () =
  let (a,b) = readStr().Split() |> pair
  (f a, g b)

let readTriple f g h () =
  let (a,b,c) = readStr().Split() |> triple
  (f a, g b, h c)

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let N = read int ()
let AB = [|for _ in 1..N -> readPair int int ()|]

let AB1 = AB |> Array.sortBy fst
let AB2 = AB |> Array.sortBy snd

if N%2 = 1 then
  let i = N/2
  let M = snd AB2.[i]
  let m = fst AB1.[i]
  (M-m+1) |> printfn "%d"
else
  let i =N/2-1
  let j =N/2
  let M = snd AB2.[i] + snd AB2.[j]
  let m = fst AB1.[i] + fst AB1.[j]
  (M-m+1) |> printfn "%d"

Measured memory_bytes: 53304
#include <bits/stdc++.h>
#define MAX 1000005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007LL
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define vll vector<ll>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
 
ll gcd(ll n1,ll n2){
	if(n2==0)
		return n1;
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
int main()
{
    ll a,b,s,d,n;
    cin>>a>>b>>s>>d>>n;
    b=min(b,2*a);
    s=min(s,2*b);
    d=min(d,2*s);
    if(n&1)
    {
    	n=n/2LL;
    	cout<<n*d+s<<endl;
        
    }
    else
    {
       cout<<n*d/2LL<<endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    ll S;
    cin >> S;
    ll x[3], y[3];
    x[0] = y[0] = 0;
    x[1] = INF;
    y[1] = 1;
    // 1e9 * y[2] - x[2] == S;
    x[2] = (INF - S % INF) % INF;
    y[2] = (S + x[2]) / INF;
    cout << x[0] << " " << y[0] << " " << x[1] << " " << y[1] << " " << x[2] << " " << y[2] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;

const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 123;
const int M = 1e6 + 123;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

void solve(){
    ll a, b;
    cin >> a >> b;
    cout << a*(a-1)/2 + b*(b-1)/2;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define mod 998244353
typedef long long ll;

ll mul(ll a, ll b) {
  return a * b % mod;
}

ll pow(ll a, ll b) {
  ll ans = 1;
  while(b) {
    if(b & 1) ans = mul(ans, a);
    a = mul(a, a), b >>= 1;
  }
  return ans;
}

ll rev(ll a) {
  return pow(a, mod - 2);
}

int main(void) {
  ll i, j, k, n, m, ans = 0, now;
  scanf("%lld%lld%lld", &n, &m, &k);
  ll fact[n];
  fact[0] = 1;
  for(i = 1; i < n; ++i) fact[i] = mul(fact[i - 1], i);
  for(i = 0; i <= k; ++i) {
    now = pow(m - 1, n - 1 - i);
    now = mul(now, fact[n - 1]);
    now = mul(now, rev(fact[i]));
    now = mul(now, rev(fact[n - 1 - i]));
    ans += now;
    ans %= mod;
  }
  ans *= m;
  ans %= mod;
  printf("%lld", ans);
  return 0;
}

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

int main(void){
  int N, M, P;
  while(cin >> N >> M >> P, N || M || P){
    float money_sum = 0;
    vector<int> ticket_number;
    for(int i=0; i < N; i++){
      int tmp; cin >> tmp;
      ticket_number.push_back(tmp);
    }

    for(int i=0; i < N; i++){
      money_sum += ticket_number[i] * 100;
    }

    money_sum = money_sum * ((100 - (float)P) / 100);
    if(ticket_number[M-1] == 0){
      cout << 0 << endl; continue;
    }

    cout << int(money_sum / ticket_number[M-1]) << endl;

  }
  return 0;
}

Measured memory_bytes: 1216
#include <iostream>
using namespace std;
#include <stdio.h>
#include <string.h>
int main()
{
  int N;
  int i = 0;
  bool tf=true;
  int a[100];
  string comment = "APPROVED";
  scanf("%d",&N);
  while(i < N)
  {
    scanf("%d ",&a[i]);
    if(a[i] % 2==0&&a[i]%3!=0 &&a[i]%5!=0)
    {
      comment = "DENIED";
      break;
    }
    i++;
  }
  printf("%s\n",comment.c_str());
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
 


int main(){
    int n;cin >> n;
    vector<P> a(n);
    for (int i = 0; i < n; i++) {
        int x,y;cin >> x >> y;
        a[i]=mp(y,x);
    }
    sort(ALL(a));
    int t = 0;
    for (int i = 0; i < n; i++) {
        t+=a[i].sc;
        if(a[i].fs<t){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 1792
// Copyright (C) 2018 Skqliao. All rights served.
#include <bits/stdc++.h>

#define rep(i, l, r) for (__typeof(l) i = (l), _##i##_ = (r); i < _##i##_; ++i)
#define rof(i, l, r) for (__typeof(l) i = (l) - 1, _##i##_ = (r); i >= _##i##_; --i)
#define irep(i, x) for (__typeof(x.begin()) i = x.begin(); i != x.end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) static_cast<int>((x).size())
typedef long long ll;
typedef std::pair<int, int> pii;
template<typename T> inline bool chkMin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkMax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

int N, K;

int main() {
	scanf("%d%d", &N, &K);
	if(K == 0) {
		printf("%lld\n", (ll)N * N);
		return 0;
	}
	ll res = 0;
	rep(i, K + 1, N + 1) {
		res += (N / i) * (i - K);
		if(N % i >= K) {
			res += N % i - K + 1;
		}
	}
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans;
    char a;
    cin >>a;

    {
        if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')cout <<"vowel"<<endl;
        else cout <<"consonant"<<endl;
    }

    dbg cout <<ans<<endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string s;
	cin >> s;
	for(int i=0; i<s.length(); i++){
		for(int j=i; j<s.length(); j++){
			string t=s.substr(0,i)+s.substr(j,s.length()-j);
			if(t=="keyence"){
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

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

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

int main()
{
	int W,H,N;
	while (cin >> W >> H >> N, W||H||N)
	{
		int a[2*H+1][2*W+1]; //a[y][x]
		memset(a, 0, sizeof(a));
		for (int i=0; i<=2*W; i++)
		{
			a[  0][i] = -1;
			a[2*H][i] = -1;
		}
		for (int i=0; i<=2*H; i++)
		{
			a[i][  0] = -1;
			a[i][2*W] = -1;
		}

		int x1,x2,y1,y2;
		for (int i=0; i<N; i++)
		{
			cin >> x1 >> y1 >> x2 >> y2;
			if (x1 == x2)
				for (int y=2*min(y1,y2); y<=2*max(y1,y2); y++)
					a[y][2*x1] = -1;
			else
				for (int x=2*min(x1,x2); x<=2*max(x1,x2); x++)
					a[2*y1][x] = -1;
		}
		int xg, yg;
		cin >> x1 >> y1 >> x2 >> y2 >> xg >> yg;

		a[y1+y2][x1+x2] = 0;
		int px=x1+x2, py=y1+y2;
		if (x1==x2)
			px += (x1==0?1:-1);
		else
			py += (y1==0?1:-1);

		int dir = (x1==x2 ? (x1==0 ? 1 : 3) : (y1==0 ? 0 : 2));
		//int pd = -1;
		int co = 1;
		bool f=1/*, pf=0*/;

		/*
		for (int y=0; y<=2*H; y++)
		{
			for (int x=0; x<=2*W; x++)
				cout << (a[2*H-y][x]==-1?'#':' ');
			cout << endl;
		}
		*/

		a[py][px] = 1;
		while (f)
		{
			//cout << "dir:" << dir << ", co:" << co << ",pd:" << pd << ",(" << py << ',' << px << ')' << endl;
			if (px==2*xg+1 && py==2*yg+1)
				break;

			if (a[py+dy[(dir+3)%4]][px+dx[(dir+3)%4]]==0)
				dir = (dir+3)%4;
			else
				while (a[py+dy[dir]][px+dx[dir]] != 0)
					dir = (dir+1)%4;

			px += 2*dx[dir]; py+= 2*dy[dir];
			if (px<0||py<0||px>2*W||py>2*H)
			{
				f=0; break;
			}

			co++;
			/*
			if (pf && co-a[py][px] == pd)
			{
				f=0; break;
			}

			if (a[py][px]==0)
				pf=0;
			else
				pf=1;
			pd = co-a[py][px];
			a[py][px] = co;
			*/
		}

		if (f)
			cout << co << endl;
		else
			cout << "Impossible" << endl;
	}
}

Measured memory_bytes: 1024
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
ll x, ans;
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//    freopen("task2-test-input.txt", "r", stdin);
//    freopen("task2-test-output.txt", "w", stdout);
    cin>>x;
    ans += x / 500 * 1000;
    x %= 500;
    ans += x / 5 * 5;
    cout<<ans;
}


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

for i in range(N-1):
    A[i] -= 1
#上司の社員番号は自分より小さい
dic = {}
for i in range(N):
    dic[i] = 0

for i in range(N-1):
    dic[A[i]] += 1
    
for i in range(N):
    print(dic[i])

Measured memory_bytes: 38896
import sys

N, M = map(lambda x: int(x), sys.stdin.readline().split(" "))

_min, _max = 1, 100000
for _ in range(0, M):
    L, R = map(lambda x: int(x), sys.stdin.readline().split(" "))
    _min = max(_min, L)
    _max = min(_max, R)
if _min > _max:
    print(0)
else:
    print(_max - _min + 1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}



int main() {
    int ans = 0;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        int sum = 0;
        while(s[i] == 'A' || s[i] == 'G' ||s[i] == 'C' ||s[i] == 'T'){
            sum++;
            i++;
        }
        ans = max(ans,sum);
    }
    cout << ans << endl;
    return 0;
}

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

int n,a,b;

map<int,int> m;

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

signed main()
{
	cin>>a>>b;
	n=gcd(a,b);
	
	if (n==1)  return cout<<1<<endl,0;
	else if (n==2||n==3)  return cout<<2<<endl,0;
	
	for (int i=2;i*i<=n;i++)
	{
		if (n%i==0)
		{
			while (n%i==0)  n/=i;
			m[i]=1;
		}
	}
	if (n!=0&&n!=1)  m[n]=1;
	cout<<m.size()+1<<endl;
	
	return 0;
}

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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int N, M;
  std::string S;
  std::cin >> N >> M >> S;

  int d = 0;
  rep(i, N + 1) {
    if(S[i] == '1') {
      ++d;
      if(d == M) {
        std::cout << "-1" << '\n';
        return 0;
      }
    }
    else {
      d = 0;
    }
  }

  std::map<int, std::vector<int>> mp;
  int pos = N;
  int x = 0;
  while(pos > 0) {
    ++x;
    int new_pos = pos;
    for(int i = 1; i <= M; ++i) {
      --pos;
      if(pos == 0){
        new_pos = pos;
        break;
      }
      if(S[pos] == '0') {
        mp[x].push_back(pos);
        new_pos = pos;
      }
    }
    pos = new_pos;
  }

  --x;
  while(pos != N) {
    if(pos + M >= N) {
      std::cout << N - pos << '\n';
      return 0;
    }

    int next = mp[x].back();
    std::cout << next - pos << ' ';
    pos = next;
    --x;
  }
}


Measured memory_bytes: 11520
# -*- coding: utf-8 -*-
"""
Created on Fri May  8 01:38:54 2020

@author: Kanaru Sato
"""

s = list(input())
count = 0
ans = 0

for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        count += 1
        ans = max(ans,count)
    else:
        count = 0

print(ans)

Measured memory_bytes: 3060