akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

vector<lint> prime_factorization(lint N) {
	//素因数分解して配列で返す
	vector<lint> R;
	if (N < 2)return R;
	for (int i = 2; i * i <= N; i++) {
		while (N % i == 0) {
			R.push_back(i);
			N /= i;
		}
	}
	if (N != 1) {
		R.push_back(N);
	}
	return R;
}

int main() {
	lint MOD = pow(10, 9) + 7;
	lint N;
	cin >> N;
	if (N == 1) {
		cout << 1 << endl;
		return 0;
	}
	vector<lint>TMP;
	vector<lint>A;
	for (lint i = 1; i <= N; i++) {
		TMP = prime_factorization(i);
		rep(j, TMP.size()) {
			A.push_back(TMP[j]);
		}
	}
	sort(A);
	lint cnt = 1;
	lint ans = 1;
	for (int i = 1; i < A.size(); i++) {
		if (A[i] != A[i - 1]) {
			ans *= cnt + 1;
			ans %= MOD;
			cnt = 1;
		}
		else {
			cnt++;
		}
	}
	ans *= cnt + 1;
	ans %= MOD;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define _              ios_base::sync_with_stdio(0);cin.tie(0);
#define pb             emplace_back
#define mp             make_pair
#define F              first
#define S              second
#define rep(i, x)      for (__typeof(x) i = 0; i < x; i++)
#define repp(i, x, y)  for (__typeof(x) i = x; i < y; i++)
#define all(a)         (a).begin(),(a).end()
#define sz(x)          (int)x.size()
#define endl           '\n'
#define DB(x)          cerr << #x << " is " << x << endl;
#define TEST(T)        int T; cin >> T; rep(i, T)
#define MOD            1000000007
typedef long long          ll;
typedef vector<int>        vi;
typedef pair<int, int>     ii;
typedef vector<ii>        vii;

int main(){ _
    int a, b, c,d; cin >>a>>b>>c>>d;
    cout << max(a*b, c*d) << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;
 
    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);
 
    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
 
        if (A > B || A < B && N == 1) {
            _out.println(0);
            return;
        }
 
        long min = (long)A * (N - 1) + B;
        long max = (long)B * (N - 1) + A;
 
        _out.println(max - min + 1);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();
 
        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();
 
        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;
typedef pair<int,string> P;
P cd[100000];
string o[100001];
int main()
{
	int n,m;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		string c;int d;
		cin>>c>>d;
		cd[i]=P(d,c);
	}
	cin>>m;
	for(int i=0;i<m;i++)
		cin>>o[i];
	o[m]="EOF";
	sort(cd,cd+n);
	int ind=0;
	int now=-1;
	for(int i=0;i<n;i++)
	{
		if(o[ind]==cd[i].second && now<cd[i].first)
		{
			now=cd[i].first;
			ind++;
		}
	}
	if(ind==m)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 21144
#include <stdio.h>

int solve(int a, int b);

int n;
int A[25];

int main() {
  int q, i;

  scanf("%d", &n);

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

  scanf("%d", &q);

  int M[q];

  for (i = 0; i < q; i++) {
    scanf("%d", &M[i]);
  }

  for (i = 0; i < q; i++) {
    if (solve(0, M[i])) {
      printf("yes\n");
    } else {
      printf("no\n");
    }
  }
}

int solve(int a, int b) {
  if (b == 0)
    return 1;
  if (a == n)
    return 0;

  return solve(a+1, b) + solve(a+1, b - A[a]);
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,s=0;cin>>n;
  vector<int>a(n),b(n),c(n-1);
  for(int i=0;i<n;i++)cin>>a.at(i);
  for(int i=0;i<n;i++)cin>>b.at(i);
  for(int i=0;i<n-1;i++)cin>>c.at(i);
  for(int i=0;i<n;i++){
    int p=a.at(i)-1;
    s+=b.at(p);
    if(i>0){
      if(a.at(i-1)==p)s+=c.at(p-1);
    }
  }
  cout<<s<<endl;
}

Measured memory_bytes: 256
/*
[abc128] F - Frog Jump
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_N = 1e5;

int N;
int s[MAX_N];
int used[MAX_N];

ll solve() {
    ll ans = 0;
    for (int d = 1; d < N - 1; d++) {
        ll t = 0;
        for (int kd = 0; d < N - 1 - kd; kd += d) {
            used[kd] = d;
            if (used[N - 1 - kd] >= d) {
                break;
            }
            t += s[kd] + s[N - 1 - kd];
            ans = max(ans, t);
        }
    }

    return ans;
}

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> s[i];
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 1024
// Copyright 2020 yaito3014
#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long A;
  long double B;
  cin >> A >> B;
  cout << (long long)floor(A * B) << endl;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const ll MOD = (ll)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll mp(ll a,ll b){ll ret=1;while(b){if(b&1)ret=ret*a%MOD;a=a*a%MOD;b>>=1;}return ret;}

struct node {
    ll t;
    int v, c;
    bool operator< (const node &v2) const {
        return t > v2.t;
    };
};

vector<node> v[50];
pii vec[50];
ll dist[50][2501];
int n, m;

priority_queue<node> pq;

int main() {
    memset(dist, 0x3f, sizeof(dist));
    int s;
    scanf("%d %d %d", &n, &m, &s);
    if (s >= 2500) s = 2500;

    while(m--) {
        int a, b, c, d;
        scanf("%d %d %d %d", &a, &b, &c, &d);
        a--; b--;
        v[a].push_back({d, b, c});
        v[b].push_back({d, a, c});
    }


    for (int i = 0; i < n; i++)
        scanf("%d %d", &vec[i].first,& vec[i].second);

    pq.push({0, 0, s});
    dist[0][s] = 0;
    while (!pq.empty()) {
        node tv = pq.top();
        pq.pop();

        // printf("%d %d : %lld\n", tv.v, tv.c, tv.t);
        if (dist[tv.v][tv.c] != tv.t) continue;

        // first코인 충전 second 타임 이용해서.
        if (tv.c != 2500) {
            if (dist[tv.v][min(2500, tv.c + vec[tv.v].first)] > tv.t + vec[tv.v].second) {
                dist[tv.v][min(2500, tv.c + vec[tv.v].first)] = tv.t + vec[tv.v].second;
                pq.push({tv.t + vec[tv.v].second, tv.v, min(2500, tv.c + vec[tv.v].first)});
            }
        }

        for (node i : v[tv.v]) {
            if (i.c <= tv.c && dist[i.v][tv.c - i.c] > tv.t + i.t) {
                dist[i.v][tv.c - i.c] = tv.t + i.t;
                pq.push({tv.t + i.t, i.v, tv.c - i.c});
            }
        }
    }


    for (int i = 1; i < n; i++) {
        ll miv = 1e18;
        for (int j = 0; j <= 2500; j++) {
            miv = min(miv, dist[i][j]);
        }
        printf("%lld\n", miv);
    }
}

Measured memory_bytes: 6216
#48 最大の和
while True:
        n, k = map(int, input().split())
        if n == k == 0:
                break
        
        a = [int(input()) for i in range(n)]
        s = sum(a[0:k])                         #リストaの0からkまでの和をsとする
        max = s                                 #maxにsを代入する
        for i in range(k,n):                    
                s = s + a[i] - a[i-k]           
                if s > max:                     #sがmaxより大きければmaxにsを代入する
                        max = s
        print(max)


Measured memory_bytes: 9880
s = input()
l = len(s)

a1 = [0]*(l+1)
a2 = [0]*(l+1)

for i in range(l):
	if s[i] == "<":
		a1[i+1] = a1[i] + 1
	else:
		a1[i+1] = 0

for i in range(l):
	if s[-i-1] == ">":
		a2[i+1] = a2[i] + 1
	else:
		a2[i+1] = 0

cnt = 0
for i in range(l+1):
	cnt += max(a1[i],a2[-i-1])

print(cnt)

Measured memory_bytes: 29236
//
//  main.cpp
//  A
//
//  Created by 黄宇凡 on 2017/3/18.
//  Copyright © 2017年 黄宇凡. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int a,b,W;

int main(int argc, const char * argv[]) {
    cin >> W >> a >> b;
    cout << max(max(0,a - b  - W),max(0,b - a - W)) << endl;
    return 0;
}


Measured memory_bytes: 256
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f
typedef long long ll;

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n_even, n_odd;
    cin >> n_even >> n_odd;
    int ans = n_even * (n_even - 1) / 2 + n_odd * (n_odd - 1) / 2;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
def main():
    import sys
    from collections import Counter
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    N = int(input())
    S = input().strip()
    cnt = Counter(S)
    ans = cnt['R'] * cnt['G'] * cnt['B']
    for i in range(N-2):
        for j in range(i+1, N-1):
            k = j + j - i
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ans -= 1

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9488
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=998244353;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    vi dp(c+1);
    dp[a]=1;
    REP(i,b+1,d+1){
        //vi ndp(c+1);
        ll sum=0;
        REP(j,a,c+1){
            sum=(sum*(i-1)+dp[j])%mod;
            dp[j]=(dp[j]*(j-1)+sum)%mod;
            //dp[j]%=mod;
        }
    }
    ll ans=0,k=1;
    for(int i=c;i>=a;i--){
        ans=(ans+dp[i]*k)%mod;
        k=k*d%mod;
    }
    out(ans);
}

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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

int main()
  {
    ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    int n ;
    bool check ;
    cin>> n ;
    vi a(n) ;
    for(int i=0 ; i<n ; i++)
      cin>> a[i] ;
    list<int> b ;
    list<int>::iterator it ;
    b.pb(a[0]) ;
    if(n%2) check=true ;
    else check=false ;
    for(int i=1 ; i<n ; i++)
      {
        if(check)
          {
            b.pb(a[i]) ;
            check=false ;
          }
        else
          {
            b.push_front(a[i]) ;
            check=true ;
          }
      }
    it=b.begin() ;
    while(it!=b.end())
      {
        cout<< *it << " " ;
        it++ ;
      }
  }


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

using namespace std;

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

int main(){
    int N;
    cin >> N;
    int A[N];
    
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    int gcdA = A[0];
    for(int i = 1; i < N; i++){
        gcdA = gcd(gcdA,A[i]);
    }


    cout << gcdA << endl;
    
    
    return 0;
}

    

Measured memory_bytes: 640
from collections import Counter
n = int(input())
a = Counter(list(map(int, input().split())))

b = []
for key, item in a.items():
    if item >= 2:
        b.append((key, item))

b.sort(key=lambda x: -x[0])

if len(b) == 1:
    if b[0][1] >= 4:
        print(b[0][0]**2)
elif len(b) >= 2:
    if b[0][1] >= 4:
        print(b[0][0]**2)
    else:
        print(b[0][0]*b[1][0])
else:
    print(0)


Measured memory_bytes: 18600
#include <iostream>
#include <cstdio>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main(void) {
  int w, a, b;
  cin >> w >> a >> b;
  if(a+w < b) {
    printf("%d\n", b - (a+w));
  } else if(b+w < a) {
    printf("%d\n", a - (b+w));
  } else {
    puts("0");
  }
  return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
ban = []
banban = []

for i in range(h):
  tmp = input()
  if tmp != '.'*w:
    ban.append(list(tmp))

for zlist in zip(*ban):
  if '#' in zlist:
    banban.append(zlist)

for letter in zip(*banban):
  print(''.join(letter))

Measured memory_bytes: 3188
A,B=map(int,input().strip().split())

def gcd(a,b):
    num=[a,b]
    GCD=0
    for i in range(1,min(num)+1):
        if a%i==0 and b%i==0:
            GCD=i
    return GCD
            
print(int(A*B/gcd(A,B)))

Measured memory_bytes: 3060
// B - Some Sums
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N,A,B; cin>>N>>A>>B;
	int ans = 0;
	rp(i, 1, N+1){
		int s = 0, n = i;
		while(n){
			s += n % 10;
			n /= 10;
		}
		if(A<=s && s<=B) ans += i;
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    PriorityQueue<Integer> pq = new PriorityQueue<>((t0, t1) -> t1 - t0);
    for (int i = 0; i < N; i++) pq.add(scanner.nextInt());
    for (int i = 0; i < M; i++) {
      int a = pq.poll();
      a /= 2;
      pq.add(a);
    }
    long sum = 0;
    for (int a : pq) sum += a;
    System.out.println(sum);
  }
}


Measured memory_bytes: 61708
#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>;
using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll min = n;
    for (ll i = 1; i <= sqrt(n); ++i ) {
        ll tmp = i * (n / i);
        if (tmp == n ) {
            if (min > (i-1) + ((n / i) - 1)) {
                min = (i-1) + ((n / i) - 1);
            }
        }
    }
    cout << min << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
const int MAX = 1000;
using namespace std;

int tu[MAX+5][MAX+5],m,n;
int main(){
	int a,b,c;
	while(cin>>a>>b>>c){
		int m = c%b;
		int flag=0,sum=a;
		for(int  i=1; i<=100; ++i){
			sum+=a;
			if(sum%b==m){
				flag=1;
				break;
			}
		}
		if(flag)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		
	}
	return 0;	
}

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

int main(){
  char s[100];
  int a=1,e,n=0,i,Stac[100];
  while(scanf("%s",s) != EOF){
    if(*s == '+'){
      Stac[n-2]+=Stac[n-1];
      a+=2;
      n--;
      e = 1;
    }else if(*s == '-'){
      Stac[n-2]-=Stac[n-1];
      a+=2;
      n--;
      e = 1;
    }else if(*s == '*'){
      Stac[n-2]*=Stac[n-1];
      a+=2;
      n--;
    }
    else {
      Stac[n] = atoi(s);
      n++;
      e = 0;
    }
     
    // a++;
  }
   for(i=0;i<n;i++){
    printf("%d\n",Stac[i]);
  }
    
   // printf("%d %d\n",Stac[0],n);

  return 0;
}



Measured memory_bytes: 2144
// 2020-08-29 21:00:00
// clang-format off
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

// clang-format on
void answer() {
  int d, t, s;
  cin >> d >> t >> s;
  if (d <= t * s) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set

    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }

    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }

    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }

    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N; cin >> N;
    int Q; cin >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
        return rights[i] < rights[j]; });

    BIT<int> bit(N + 5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]] + 2, r + 2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i] + 1, lefts[i] + 2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}


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

using namespace std;

long long f(long long a, long long b) {
    return !b?a:f(b,a%b);
}

bool isPrime(long long i) {
    for (long long ii=2; ii*ii<=i; ii++) {
        if (i%ii==0) return 0;
    }
    return 1;
}

int main() {
    long long a, b, cnt=0;
    scanf("%lld%lld",&a,&b);
    long long c=a>b?f(a,b):f(b,a);
    if (c==1) { printf("1"); return 0; }
    for (long long i=1; i*i<=c; i++) {
        if (c%i==0) {
            if (isPrime(i)) cnt++;
            if (isPrime(c/i) && i!=c/i) cnt++;
        }
    }
    printf("%lld",cnt);
    return 0;
}

Measured memory_bytes: 256
import java.util.*

private fun getInts() : List<Int> {
    return readLine()!!.split(" ").map {it.toInt()}
}

class Node {
    val connected : MutableSet<Node> = HashSet()

    fun connectTo(another: Node) {
        this.connected.add(another)
        another.connected.add(this)
    }
}

fun main(args: Array<String>) {
    val fl = getInts()
    val N = fl[0]
    val M = fl[1]

    val nodes = ArrayList<Node>()
    (1..N).forEach {
        nodes.add(Node())
    }
    (1..M).forEach {
        val ab = getInts()
        val a = ab[0]
        val b = ab[1]
        nodes[a - 1].connectTo(nodes[b - 1])
    }

    if (nodes[0].connected.find { it.connected.contains(nodes[N - 1]) } == null) {
        println("IMPOSSIBLE")
    } else {
        println("POSSIBLE")
    }
}


Measured memory_bytes: 134368
#include <bits/stdc++.h>
#define lowbit(x) ((x) & (-x))
#define mem(i, a) memset(i, a, sizeof(i))
#define sqr(x) ((x) * (x))
#define ls(x) (x << 1)
#define rs(x) (x << 1 | 1)
typedef long long ll;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
// const int maxn = e + 7;
using namespace std;
int main(void) {
#ifdef ljxtt
    freopen("data.in", "r", stdin);
#endif
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int t;
        cin >> t;
        n -= t;
    }
    if (n < 0)
        cout << -1 << endl;
    else
        cout << n << endl;
    return 0;
}

Measured memory_bytes: 3632
def dfs(coord, visited, route, sum):
    n = len(visited)

    allVisited = True
    for city in range(n):
        if visited[city] is False:
            allVisited = False
            break

    if allVisited is True:
        dist = 0

        for i in range(1, len(route)):
            prev = route[i - 1]
            cur = route[i]
            dist += (
                (coord[prev][0] - coord[cur][0]) ** 2
                + (coord[prev][1] - coord[cur][1]) ** 2
            ) ** 0.5
        sum += dist
        return sum

    for next_city in range(n):
        if visited[next_city] is False:
            visited[next_city] = True
            route.append(next_city)
            sum = dfs(coord, visited, route, sum)
            visited[next_city] = False
            route.pop(-1)

    return sum


n = int(input())
coord = []
route = []
visited = [False] * n

for i in range(n):
    x, y = map(int, input().split())
    coord.append([x, y])


sum = 0
sum = dfs(coord, visited, route, sum)

perm = 1
for i in range(1, n + 1):
    perm *= i

print(sum / perm)



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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int bit[15];
int com[15][15];
string in[15];
int dp[15][1<<15];

int main(void){
	int n;
	while(cin >> n,n){
		rep(i,n) cin >> in[i];
		rep(i,n)rep(j,1<<n) dp[i][j]=inf;
		rep(i,n) bit[i]=(1<<i);

		rep(i,n)rep(j,n){
			if(i==j) continue;
			if(in[i].find(in[j])!=string::npos){
				bit[i]|=bit[j];
				bit[j]=0;
			}
		}

		rep(i,n) dp[i][bit[i]]=in[i].size();

		rep(i,n)rep(j,n){
			if(i==j) continue;
			int cs=in[i].size();
			int ns=in[j].size();
			for(int a=min(cs,ns);a>=0;--a){
				if(in[i].substr(cs-a,a)==in[j].substr(0,a)){
					com[i][j]=ns-a;
					break;
				}
			}
		}

		rep(mask,1<<n){
			rep(i,n)rep(j,n){
				dp[j][mask|bit[j]]=min(dp[j][mask|bit[j]],dp[i][mask]+com[i][j]);
			}
		}
		int ans=dp[0][(1<<n)-1];
		rep(i,n) ans=min(ans,dp[i][(1<<n)-1]);
		cout << ans << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
    string s, t;
    const string YES = "Yes";
    const string NO = "No";
    cin >> s >> t;

    // cout << "[" << s << "]" << endl;
    // cout << "[" << t << "]" << endl;

    if(s.empty() || t.empty()) {
        cout << NO;
        return 0;
    }
    if(s.length() == 0 || s.length() > 10) {
        cout << NO;
        return 0;
    }
    if(s.length() + 1 != t.length()) {
        cout << NO;
        return 0;
    }
    // cout << "here" << endl;
    // cout << s.length() << endl;
    // cout << s.compare(0, s.length(), t) << endl;
    if(0 != t.compare(0, s.length(), s)) {
        cout << NO;
        return 0;
    }

    cout << YES;
    return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

#define np std::string::npos
string t;

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

	cin>>t;
	auto n=(t.find('N')==np),s=(t.find('S')==np);
	auto w=(t.find('W')==np),e=(t.find('E')==np);
	if(n!=s||w!=e) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;

	return 0;
}


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

int main()
{
    string a, b, c;
    cin >> a >> b >> c;

    if(a[a.length()-1]==b[0]){
        if(b[b.length()-1]==c[0]){
            cout << "YES";
        }
        else
        {
            cout << "NO";
        }
    }
    else
    {
        cout << "NO";
    }
    

    return 0;
}

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

import numpy as np
A0 = [0] + A
B0 = [0] + B
AA = np.cumsum(A0)
BB = np.cumsum(B0)

ans = 0
jmax = M
for i in range(0, N+1):
    a = AA[i]
    if a > K:
        break
    for j in range(jmax, -1, -1):
        b = BB[j]
#        print(a, b)
        if a + b <= K:
            ans = max(ans, i+j)
#            print('ok')
            break
    jmax = j
print(ans)

Measured memory_bytes: 50288
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

template<typename T1, typename T2>
istream& operator >> (istream& is, pair<T1, T2>& p){
  is >> p.first >> p.second;
  return is;
}

vector<vector<int>> G;
vector<bool> visited;

void dfs(int v) {
  for (const auto& u : G[v]) {
    if (visited[u]) continue;
    visited[u] = true;
    dfs(u);
  }
}

int main() {
  int N, M; cin >> N >> M;
  vector<pair<int, int>> es(M);
  for (int i = 0; i < M; ++i) {
    cin >> es[i];
    es[i].first--, es[i].second--;
  }

  int cnt = 0;
  for (int m = 0; m < M; ++m) {
    G = vector<vector<int>>(N);
    visited = vector<bool>(N, false);
    for (int i = 0; i < M; ++i) {
      if (i == m) continue;
      auto& e = es[i];
      G[e.first].push_back(e.second);
      G[e.second].push_back(e.first);
    }

    visited[0] = true;
    dfs(0);

    bool connected = true;
    for (bool b : visited) {
      if (!b) {
        connected = false;
        break;
      }
    }
    if (!connected) ++cnt;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException e){
			e.printStackTrace();
		}
	}
	
	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line;
		
		while((line = in.readLine()) != null){
			int size = Integer.parseInt(line);
			for(int i=0; i<size; i++){
				line = in.readLine();
				String[] tmp = line.split(" ");
				int[] pts = new int[tmp.length];
				for(int j=0; j<tmp.length; j++){
					pts[j] = Integer.parseInt(tmp[j]);
				}
				
				Point p1 = new Point(pts[0], pts[1]);
				Point p2 = new Point(pts[2], pts[3]);
				Point p3 = new Point(pts[4], pts[5]);
				Point pk = new Point(pts[6], pts[7]);
				Point ps = new Point(pts[8], pts[9]);
				Point vk1 = new Point(p1.x - pk.x, p1.y - pk.y);
				Point vk2 = new Point(p2.x - pk.x, p2.y - pk.y);
				Point vk3 = new Point(p3.x - pk.x, p3.y - pk.y);
				Point vs1 = new Point(p1.x - ps.x, p1.y - ps.y);
				Point vs2 = new Point(p2.x - ps.x, p2.y - ps.y);
				Point vs3 = new Point(p3.x - ps.x, p3.y - ps.y);
				int k12 = Point.outer(vk1, vk2);
				int k23 = Point.outer(vk2, vk3);
				int k31 = Point.outer(vk3, vk1);
				int s12 = Point.outer(vs1, vs2);
				int s23 = Point.outer(vs2, vs3);
				int s31 = Point.outer(vs3, vs1);
				
				boolean bk = k12 == k23 && k23 == k31;
				boolean bs = s12 == s23 && s23 == s31;
				if(bk != bs){
					System.out.println("OK");
				}else{
					System.out.println("NG");
				}
			}
		}
	}
}

class Point{
	int x;
	int y;
	public Point(int x, int y){
		this.x = x;
		this.y = y;
	}
	
	public static int outer(Point p1, Point p2){
		return sign(p1.x * p2.y - p2.x * p1.y);
	}
	
	private static int sign(int a){
		if(a>0) return 1;
		else if(a==0) return 0;
		else return -1;
	}
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(ll x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { ll d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll modpow(ll x, ll p) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % MOD; } now*=2; pm = pm*pm % MOD; } return result; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

int main() {
  ll H, W, N; cin >> H >> W >> N;
  ll sr, sc; cin >> sr >> sc;
  string S, T; cin >> S >> T;
  string result = "YES";
  ll L = 1, R = W, U = 1, D = H;
  per(i,N) {
    if (i!=N-1) {
      if (T[i]=='L') R = min(W,R+1);
      else if (T[i]=='R') L = max(1ll,L-1);
      else if (T[i]=='U') D = min(H,D+1);
      else if (T[i]=='D') U = max(1ll,U-1);
    }
    if (S[i]=='L') L++;
    else if (S[i]=='R') R--;
    else if (S[i]=='U') U++;
    else if (S[i]=='D') D--;

    if (L>R||U>D) { result = "NO"; break; }
    // cout << L << "-" << R << " " << U << "-" << D << endl;
  }

  if (L>sc||R<sc||U>sr||D<sr) result = "NO";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3920
from operator import mul
from functools import reduce

n = int(input())
a = [[] for i in range(n)]

a = [int(i) for i in input().split()]
b = [0]*(n+1)

for i in a:
    b[i] +=1

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def ans(N):
    if N >= 2:
        return(cmb(N,2))
    else: return(0)

cnt=0
for j in b: cnt += ans(j)
for i in a:
    temp = cnt
    temp = temp - (ans(b[i])- ans(b[i]-1))
    print(temp)


Measured memory_bytes: 104524
use std::io;
use std::str;
use std::usize;
use std::cmp;

fn main() {
    let inf = 1000000007;
    let x = read_values::<i64>()[0];
    let k = read_values::<usize>()[0];
    let r = {
        let mut v: Vec<i64> = read_values::<i64>();
        v.push(inf);
        v
    };
    let q = read_values::<usize>()[0];
    let (t, a) = {
        let mut t = vec![inf; q + 1];
        let mut a = vec![inf; q + 1];
        for i in 0..q {
            let v = read_values::<i64>();
            t[i] = v[0];
            a[i] = v[1];
        }
        (t, a)
    };

    let mut y = 0;
    let mut w = 0;
    let mut z = x;
    let mut r_head = 0;
    let mut t_head = 0;
    let mut prev_turn = 0;
    let mut up = true;

    let mut bankrupt = false;
    let mut height = 0;

    while r_head < k || t_head < q {
        if r[r_head] < t[t_head] {
            // turn
            let time = r[r_head] - prev_turn;
            if up {
                y -= time;
                if y < 0 && y.abs() > w {
                    w = y.abs();
                }
            } else {
                y += time;
                if y > 0 && x - y < z {
                    z = x - y;
                }
            }

            if bankrupt && up {
                height = cmp::max(0, height - time);
            } else if bankrupt && !up {
                height = cmp::min(x, height + time);
            } else if !bankrupt && w >= z {
                bankrupt = true;
                if up {
                    height = 0;
                } else {
                    height = x;
                }
            }

            up = !up;
            prev_turn = r[r_head];
            r_head += 1;
        } else {
            // query
            let time = t[t_head] - prev_turn;
            let mut ans = if a[t_head] > z {
                z + y
            } else if a[t_head] < w {
                w + y
            } else {
                a[t_head] + y
            };

            if up {
                ans -= time;
            } else {
                ans += time;
            }

            if bankrupt {
                if up {
                    ans = height - time;
                } else {
                    ans = height + time;
                }
            }

            ans = cmp::min(x, ans);
            ans = cmp::max(0, ans);

            println!("{}", ans);
            t_head += 1;
        }
    }
}

fn read_line() -> String {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf
}

fn read_values<T>() -> Vec<T>
    where T: std::str::FromStr,
          T::Err: std::fmt::Debug
{
    read_line()
        .split(' ')
        .map(|a| a.trim().parse().unwrap())
        .collect()
}

Measured memory_bytes: 9340
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;

int p[210];

int main(int argc, char const *argv[]) {
    ll n, k;
    cin >> n >> k;
    if(n>k){
        n%=k;
    }
    chmin(n,k-n);
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define debug(x) cerr<<#x<<" = "<<x
#define sp <<"  "
#define el <<endl
#define fgx cerr<<" ---------------------------------------------- "<<endl
#define uint unsigned int 
#define ULL unsigned long long
#define DB long double
#define LDB long double
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define rint register int 
namespace IO{
	const int BS=(1<<23)+5; int Top=0;
	char Buffer[BS],OT[BS],*OS=OT,*HD,*TL,SS[20]; const char *fin=OT+BS-1;
	char Getchar(){if(HD==TL){TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);} return (HD==TL)?EOF:*HD++;}
	void flush(){fwrite(OT,1,OS-OT,stdout),OS=OT;}
	void Putchar(char c){*OS++ =c;if(OS==fin)flush();}
	void write(int x){
		if(!x){Putchar('0');return;} if(x<0) x=-x,Putchar('-');
		while(x) SS[++Top]=x%10,x/=10;
		while(Top) Putchar(SS[Top]+'0'),--Top;
	}
	inline LL read(){
		LL nm=0; bool fh=true; char cw=getchar();
		for(;!isdigit(cw);cw=getchar()) fh^=(cw=='-');
		for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
		return fh?nm:-nm;
	}
} using namespace IO;
#define mod 998244353
namespace CALC{
	inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);}
	inline int mns(int x,int y){return (x-y<0)?(x-y+mod):(x-y);}
	inline int mul(int x,int y){return (LL)x*(LL)y%mod;}
	inline void upd(int &x,int y){x=(x+y>=mod)?(x+y-mod):(x+y);}
	inline void dec(int &x,int y){x=(x-y<0)?(x-y+mod):(x-y);}
	inline int qpow(int x,LL sq){int res=1;for(;sq;sq>>=1,x=mul(x,x))if(sq&1)res=mul(res,x);return res;}
}using namespace CALC;
#define M 500020
#define INF 1000000000000000000ll
int n;
LL a[M],b[M],mx[M],mi[M],ans;
int main(){
	n=read();
	for(int i=0;i<=n;i++) a[i]=read(),b[i]=a[i];
	if(a[0]>1){puts("-1");return 0;}
	if(a[0]==1){puts(n>0?"-1":"1");return 0;}
	mx[n]=mi[n]=0,ans=b[0]=1;
	for(int i=n-1;i>=0;--i) mx[i]=mx[i+1]+a[i+1],mi[i]=((mi[i+1]+a[i+1]+1)>>1);
	for(int i=1;i<=n;i++) if(mi[i]>mx[i]){puts("-1");return 0;}
	if(mi[0]>1||mx[0]<1){puts("-1");return 0;}
	for(int i=1;i<=n;++i)
		b[i]=min((b[i-1]<<1)-a[i],mx[i]),ans+=a[i]+b[i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 6840
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

void factrization(int n, map<int, int> &ret) {
  int target = n;
  int divider = 2;

  while (target != 1 && divider <= n) {
    if( target % divider == 0) {
      target = target / divider;
      if (ret.count(divider) > 0) {
        int current = ret.at(divider);
        ret.erase(divider);
        ret.insert(make_pair(divider, current + 1));
      } else {
        ret.insert(make_pair(divider, 1));
      }
    } else {
      divider++;
    }
  }
}


int main() {
  int N;
  cin >> N;

  map<int, int> ret;
  for(int i = 1; i <= N; i++) {
    factrization(i, ret);
  }

  ll result = 1;
  for(int i = 1; i <= N; i++) {
    if(ret.count(i) > 0) {
      result =  (result * (ret.at(i) + 1)) % MOD;
    }
  }

  cout << result << endl;
}


Measured memory_bytes: 256
from collections import Counter

s = input()
a = [0]
mod = 2019

for i,j in enumerate(s[::-1]):
    a.append(a[-1] + int(j)*pow(10,i,mod))
    a[-1] %= mod
b = Counter(a)

ans = 0
for i in b.values():
    ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 16804
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedInputStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DXorSum4 solver = new DXorSum4();
        solver.solve(1, in, out);
        out.close();
    }

    static class DXorSum4 {
        private static final long MOD = 1000000007L;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long[] arr = new long[n];
            for (int i = 0; i < n; ++i) {
                arr[i] = in.nextLong();
            }
            long sum = 0;
            for (int i = 0; i < 62; i++) {
                long zeroCount = 0, oneCount = 0, bitSum = 0;
                for (int j = 0; j < n; j++) {
                    if ((arr[j] & 1) == 0) {
                        zeroCount++;
                    } else {
                        oneCount++;
                    }
                }
                bitSum = oneCount * zeroCount;
                bitSum = ((bitSum % MOD) * ((1L << i) % MOD)) % MOD;
                sum = (sum + bitSum) % MOD;
                for (int j = 0; j < n; ++j) {
                    arr[j] >>= 1L;
                }
            }
            out.println(sum);
        }

    }

    static class InputReader {
        private StringTokenizer st;
        private BufferedReader reader;

        public InputReader(InputStream is) {
            st = null;
            reader = new BufferedReader(new InputStreamReader(new BufferedInputStream(is, 1 << 18)));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

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

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

    }
}



Measured memory_bytes: 80344
/*author - swapno7064*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long int
#define inf 100000000000
#define MOD 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define for0(i, n) for (int i = 0; i < n; i++)
#define tc(t) int t; cin >> t; while (t--)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ps(x,y)         fixed<<setprecision(y)<<x
using namespace std;
using namespace __gnu_pbds;
int main()
{
	IOS
	int x,y;
	cin>>x>>y;
		if(y%2==1 || y>x*4 || y<2*x){cout<<"No";}
	else{cout<<"Yes";}
	return 0;
}
	
		
		
	
	


Measured memory_bytes: 3620
#!/usr/bin/python
# coding: utf-8
import os
from sys import stdin, stdout

if(os.getenv('__LOCAL__')):
    __dirname = os.path.dirname(__file__)
    __basename = os.path.splitext(os.path.basename(__file__))[0]
    __inputname = './input/' + __basename + '.txt'
    __outputname = './output/' + __basename + '.txt'
    __input_path = os.path.join(__dirname, __inputname)
    __output_path = os.path.join(__dirname, __outputname)
    stdin = open(__input_path)
    # stdout = open(__output_path, "w")

def main():
    N = int(stdin.readline().rstrip())
    ans=0
    for _ in range(N):
        x, v = stdin.readline().rstrip().split(' ')
        x = float(x)
        if(v=="JPY"):
            ans+=x
        else:
            ans+=x*380000
    stdout.write("{}\n".format(ans))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h> 
#include<vector> 
#include<iterator> 
#include<deque> 
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i <(n) ; i++)
#define rep2(i,s,n) for(long long i = (s); i(n) ; i++)
#define ll long long

int main(){

  int N,W;
  cin >> N >> W;
  ll dp[101][100001]={0};

  rep(i,N){
    ll w,v;
    cin >> w >> v;
    rep(j,W+1){
      int dw;
      if(j-w>=0){
        dw = j-w;
        dp[i+1][j] = max(dp[i][j],dp[i][dw]+v);
      }
      else dp[i+1][j] = dp[i][j];
    }

  }

//  rep(i,N){
//    rep(j,W){
//      cout << dp[i][j] <<" ";
//    } 
//    cout<<endl;
//  }
  ll ans = 0;
  rep(i,W+1) ans = max(ans,dp[N][i]);
  cout << ans <<endl;
}


Measured memory_bytes: 79104
N = int(input())
A = [int(i) for i in input().split()]
count = 0
S = []

for i in A:
    i = [i,count]
    count += 1
    S.append(i)

S.sort()
for i,j in S:
    print(j+1,end = "")
    count -= 1
    if(count != 0):
        print(" ",end="")

Measured memory_bytes: 21508