akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n, k; cin >> n >> k;
  vector<vector<ll>> book(11);
  rep(i, n) {
    ll c; int g;
    cin >> c >> g;
    book[g].push_back(c);
  }
  for(int i = 1; i <= 10; ++i) {
    sort(RALL(book[i]));
    book[i].insert(book[i].begin(), 0);
    rep(j, SZ(book[i])-1) book[i][j+1] += book[i][j];
  }

  ll dp[11][k+10];
  rep(i, 11) rep(j, k+10) dp[i][j] = 0;
  rep(i, 10) {
    for(int j = 0; j <= k; ++j) {
      for(ll l = 0; l <= min(j, SZ(book[i+1])-1); ++l) chmax(dp[i+1][j], dp[i][j-l]+book[i+1][l]+l*(l-1));
    }
  }
  cout << dp[10][k] << endl;
}



Measured memory_bytes: 3224
s = input()
ans = 0
if s[0] == 'A':
    ans += 1
cnum = 0
for i in range(2,len(s)-1):
    if s[i] == 'C':
        cnum += 1
if cnum == 1:
    ans += 1
hantei = 0
for i in range(len(s)):
    if s[i].islower():
        pass
    else:
        hantei += 1
if hantei == 2:
    ans += 1
if ans == 3:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<string>v;
int main() {
	string s; cin >> s;
	int k; cin >> k;
	for (int i = 0; i < s.size() - 1; i++) {
		for (int j = 1; j <= min((size_t)k, s.size() - i); j++) {
			v.push_back(s.substr(i, j));
		}
	}
	v.push_back(s.substr(s.size() - 1, 1));
	sort(v.begin(), v.end());
	auto r = unique(v.begin(), v.end());
	v.erase(r, v.end());
	cout << v[k - 1] << endl;
}

Measured memory_bytes: 1660
#include <stdio.h>

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

  int* a = new int[N];
  for(int i=0;i<N;i++) {
    scanf("%d", &a[i]);
  }

  int res = 0;
  int tmp = a[0];
  int cnt = 1;
  for(int i=1;i<N;i++) {
    if(a[i] == tmp) {
      cnt++;
    } else {
      res += (cnt/2);
      tmp = a[i];
      cnt = 1;
    }
  }
  res += cnt/2;

  printf("%d\n", res);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int x;
    cin >> x;
    cout << 360 / __gcd(360, x) << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

using namespace std;

int main() {
	long long a, b;
	cin >> a >> b;
	long long x = 1ll << 55;
	x *= 2;
	long long y = 1ll << 55;
	y *= 2;
	if(b >= a) x = b - a;
	if(a <= -b) x = min(x, -b - a + 1);
	
//	else if(b < a && b < 0 && -b >= a) x = min(x , -b - a + 1); 
	a *= -1;
	if(b >= a) y = b - a + 1;
	if(a <= -b) y = min(y, -b - a + 2);
	printf("%lld\n", min(x, y));
}


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

const int MAX_N = 2e3 + 6, inf = 1e9 + 7;
int n, k;
vector <int> G[MAX_N];
int dis[MAX_N];

void dfs(int v, int par) {
	dis[v] = 1 + dis[par];
	for (int i = 0; i < G[v].size(); i++)
		if (G[v][i] != par)
			dfs(G[v][i], v);
}

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 1; i < n; i++) {
		int v, u;
		scanf("%d %d", &v, &u);
		v--; u--;
		G[v].push_back(u);
		G[u].push_back(v);
	}
	int res = inf;
	if (k & 1) {
		for (int i = 0; i < n; i++)
			for (int j = 0; j < G[i].size(); j++)
				if (G[i][j] < i) {
					dis[i] = -1;
					dfs(G[i][j], i);
					dis[G[i][j]] = -1;
					dfs(i, G[i][j]);
					int tmp = 0;
					for (int i = 0; i < n; i++)
						tmp += ((k >> 1) < dis[i]);
					res = min(res, tmp);
				}
	}
	else {
		for (int i = 0; i < n; i++) {
			dis[i] = -1;
			dfs(i, i);
			int tmp = 0;
			for (int i = 0; i < n; i++)
				tmp += ((k >> 1) < dis[i]);
			res = min(res, tmp);
		}
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 512
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let _ = scan!(usize);
    let vs = scan!(usize;;);
    let m = scan!(usize);
    let ws = scan!(usize, usize;m);
    for (p, x) in ws {
        let mut sum = 0;
        for (i, &v) in vs.iter().enumerate() {
            sum += if i + 1 == p { x } else { v }
        }
        println!("{}", sum)
    }
}


Measured memory_bytes: 4352
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	string s ; cin >> s ;
	ll n = s.size() ;
	vll cnt(n,0) ;
	ll r = 0 ;
	for(int i=0;i<n;i++){
		if(s.at(i)=='L') continue ;
		if(s.at(i+1)=='L'){
			cnt.at(i)++ ;
			cnt.at(i) += r/2 ;
			cnt.at(i+1) += (r+1)/2 ;
			r = 0 ;
		}else{
			r++ ;
		}
	}
	ll l = 0 ;
	for(int i=n-1;i>=0;i--){
		if(s.at(i)=='R') continue ;
		if(s.at(i-1)=='R'){
			cnt.at(i)++ ;
			cnt.at(i) += l/2 ;
			cnt.at(i-1) += (l+1)/2 ;
			l = 0 ;
		}else{
			l++ ;
		}
	}
	for(int i=0;i<n;i++){
		cout << cnt.at(i) ;
		if(i==n-1) cout << endl ;
		else cout << " " ;
	}
}


Measured memory_bytes: 1536
from collections import deque

A = deque()

#0:pushBack
def pushBack(op,x):
  if op == 0:
    A.appendleft(x)
  else:
    A.append(x)

#1:randomAccess
def randomAccess(x):
  print(A[x])
  
#2:popBack
def popBack(op):
  if op == 0:
    A.popleft()
  else:
    A.pop()


cmdList = [ pushBack, randomAccess, popBack ]
n = int(input())

for i in range(n):
  cmd = input()
  if cmd.startswith("0"):
    c,o,x = map(int,cmd.split(" "))
    cmdList[0](o,x)
  if cmd.startswith("1"):
    c,param = map(int,cmd.split(" "))
    cmdList[1](param)
  if cmd.startswith("2"):
    c,o = map(int,cmd.split(" "))
    cmdList[2](o)


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

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

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

    vector<int> a(n);
    rep(i, n) cin >> a[i];

    rep(c, k){
        vector<int> imos(n+1, 0);
        rep(i, n){
            int from = max(0, i-a[i]);
            int to = min(n, i+a[i]+1);

            ++imos[from];
            --imos[to];        
        }

        rep1(i, n+1) imos[i] += imos[i-1];

        a = imos;

        bool flg = true;
        rep(i, n){
            if(a[i] != n){
                flg = false;
                break;
            }
        }
        if(flg) break;

    }

    rep(i, n) cout << a[i] << " ";
    cout << endl;    

    return 0;
}

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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int cnt=0;
  for(int i=0;i<n;i++){
    cnt+=a[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(a[i]*(4*m)>=cnt)ans++;
  }
  if(ans>=m)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3588
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		for(int k = 1; k <= m; k++) {
			for(int i = 0; i < n - 1; i++) {
				if(a[i] % k > a[i + 1] % k) {
					int tmp = a[i];
					a[i] = a[i + 1];
					a[i + 1] = tmp;
				}
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.println(a[i]);
		}
	}
}


Measured memory_bytes: 26168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(a-c)<=d) cout << "Yes" << endl;
  else if(abs(a-b)<=d&&abs(b-c)<=d) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll N; cin >> N;
    ll cur = 26;
    int val = 1;
    while (N > cur) {
        N -= cur; cur *= 26; val++;
    }

    N--;

    string S;
    F0R(i, val) {
        S += 'a' + N % 26;
        N /= 26;
    }
    reverse(all(S));
    cout << S << nl;

	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


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

int n,m;
int trip[100000];
int fare_r[100000];
int ic[100000];
int fare_i[100000];
long long mycount[100000]={};
long long rui[100000]={};

void countcreate(void){
	int prev,next;
	prev=trip[0]-1;
	for(int lp=1;lp<m;lp++){
		next=trip[lp]-1;
		if(prev<next){
			rui[prev]++;
			rui[next]--;
		}else{
			rui[next]++;
			rui[prev]--;
		}
		prev=next;
	}
	mycount[0]=rui[0];
	for(int lp=1;lp<n-1;lp++){
		mycount[lp]=mycount[lp-1]+rui[lp];
	}
}

long long solve(void){
	long long answer=0;
	long long sum_r,sum_i;
	for(int lp=0;lp<n-1;lp++){
		sum_r=fare_r[lp]*mycount[lp];
		sum_i=fare_i[lp]*mycount[lp]+ic[lp];
		//printf("rail %d count:%d real:%d, ic:%d\n",lp,mycount[lp],sum_r,sum_i);
		if(sum_r>sum_i){
			
			answer+=sum_i;
		}else{
			answer+=sum_r;
		}
	}
	return answer;
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int lp=0;lp<m;lp++){
		scanf("%d",&trip[lp]);
	}
	for(int lp=0;lp<n-1;lp++){
		scanf("%d %d %d",&fare_r[lp],&fare_i[lp],&ic[lp]);
	}
	
	countcreate();
	printf("%lld\n",solve());
	
	return 0;
}

Measured memory_bytes: 6328
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;


signed main(){
	int T1, T2;
	cin >> T1 >> T2;
	int A1, A2;
	cin >> A1 >> A2;
	int B1, B2;
	cin >> B1 >> B2;
	int diff1 = A1 - B1;
	int diff2 = A2 - B2;
	int dis1 = T1 * diff1, dis2 = T2 * diff2;
	if(dis1 == -dis2) {
		out("infinity");
		return 0;
	}
	if(abs(dis1) > abs(dis2) || (dis1 > 0 == dis2 > 0)) {
		out(0);
		return 0;
	}
	// 必ずdis1 < dis2!
	int x = -dis1 / (dis2 + dis1);
	if(dis1 % abs(dis2 + dis1)) {
		out(1 + 2 * x);
	} else {
		out(1 + 2 * (x - 1) + 1);
	}
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

int main(){
  int N; cin>>N;
  char s[N]; cin>>s;
  int r = 0;
  char pre,cur;
  REP(i,N){
    if(i==0){
      pre = s[0];
      r++;
    }
    else{
      cur = s[i];
      if(cur!=pre){
        r++;
        pre = cur;
      }
    }
  }
  cout << r;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

int main() {
    int X;
    cin >> X;
    if(X >= 30){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    string s;cin >> s;
    stack<char> st;
    int n = s.size();
    inc(i, 0, n){
        if(st.size()){
            if(st.top() != s[i]){
                st.pop();
                continue;
            }
        }
        st.push(s[i]);
    }
    cout << (n-st.size()) << endl;
    return 0;
}


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

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	long long ans = 0;
	for(int i = k + 1; i <= n; ++i){
		ans += (n / i) * 1LL * (i - k);
		if(n % i >= k) ans += (n % i) - k + 1;
	}
	if(k == 0) ans -= n;
	cout << ans << endl;
	return 0;
}


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

#define rep(i,n) for (int i = 0; i < n; i++)
#define repd(i,n) for (int i = n-1; i >= 0; i--)
#define fo(i,a,b) for (int i = a; i < b; i++)
#define fod(i,a,b) for (int i = a; i >= b; i--)
#define umap unordered_map<int,int>
#define mii map<int,int>
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define pqMin priority_queue<int,vector<int>,greater<int>>
#define pqMax priority_queue<int>
#define pqpii priority_queue<pii>
#define all(v) v.begin(),v.end()
#define sortall(v) sort(all(v))
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define w(t) int t; cin>>t; while (t--)
#define out(x, y) cout << x << " " << y << endl
#define print(x) cout << x << endl
#define ps(x,y) fixed<<setprecision(y)<<x
#define pprint cout<<"Case #"<<tt<<": ";
const int mod = 1e9+7;
const int N = 2e5;
const int inf = 1e18;

int add(int a,int b){int res=(a+b)%mod;return (res<0)?res+mod:res;}
int mul(int a,int b){int res=(a*1LL*b)%mod;return (res<0)?res+mod:res;}
bool compare (int x, int y) { return x > y;}

struct Compare {
    bool operator () (pii A, pii B) {
        return A.first > B.first;
    }
};
 struct tri{
   int x,y,z;
 };
 struct cmp{
bool operator ()(tri a,tri b){
    if(a.x==b.x)
        return a.y>b.y;
    return a.x<b.x;

}};
bool comp(pii a,pii b){
    if(a.first>b.first) return true;
    else if(a.first==b.first) return a.second<b.second;
    else return false;

}
int binarySearch(vector<int>nums, int lo, int hi, int target) {
        while (lo < hi) {
            int mid = (lo + hi)/2;
            if (nums[mid] <= target) {
                lo = mid + 1;
            } else {
                hi = mid;
            }
        }
        return lo;
    }

void solve() {

    int t = 1;
    //cin >> t;
    while(t--){
        int a,b,c;
        cin>>a>>b>>c;
        if(b*c>=a) cout<<"Yes";
        else cout<<"No"<<endl;

    }
}

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

   /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);1

    freopen("output.txt", "w", stdout);
    #endif*/

    solve();

    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;


ll ans,mx,mn=1e8,sum,cnt;
int main(){
	ll n;
	cin>>n;
	ans = 1e9+7;
	sum=1ll;
	for(ll i=1; i<=n; i++){
		sum *=i;
		sum %=1000000007;
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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;

const int M = 151;

struct Res{
    int h, w;
    int l;
};

int main(void){
    Res res;
    for(int h, w; cin >> h >> w, h; cout << res.h << " " << res.w << endl){
        int len = sqr(h) + sqr(w);
        res.l = inf;

        range(hh, 1, M){
            range(ww, hh + 1, M){
                int curlen = sqr(hh) + sqr(ww);

                if(len < curlen || (len == curlen && h < hh)){
                    if(curlen < res.l){
                        res.w = ww, res.h = hh;
                        res.l = curlen;
                    }
                }
            }
        }
    }

	return 0;
}

Measured memory_bytes: 1160
N = int(input())
An = list(map(int, input().split()))
Bn = list(map(int, input().split()))
remain = 0
ans = 0
li = []
for a, b in zip(An, Bn):
    if a >= b:
        li.append(a-b)
    else:
        ans += 1
        remain += (b-a)
if sum(li) < remain:
    ans = -1
elif ans == 0:
    pass
else:
    temp = 0
    for num in sorted(li, reverse=True):
        if temp >= remain:
            break
        temp += num
        ans += 1
print(ans)


Measured memory_bytes: 18356
import java.util.ArrayList;
import java.util.Scanner;

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

        ArrayList<String> charBefore = new ArrayList<>();
        ArrayList<String> charAfter = new ArrayList<>();

        for (int i = 0; i < string.length(); i++) {
            charBefore.add(string.substring(i, i + 1));
            charAfter.add(charBefore.get(i).toUpperCase());
            if (charBefore.get(i).equals(charAfter.get(i))) {
                charAfter.set(i, charBefore.get(i).toLowerCase());
            }
            System.out.print(charAfter.get(i));
        }
        System.out.println();
    }
}

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

const int nax=1e5+5;
ll a[nax*3];
ll dp[3*nax];
ll dp2[3*nax];

multiset<ll> xd;

int main()
{
    int n; cin>>n;
    for(int i=1;i<=3*n;i++) cin>>a[i];
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        sum+=a[i];
        xd.insert(a[i]);
    }
    dp[n]=sum;
    for(int i=n+1;i<=2*n;i++)
    {
        if(a[i]>*xd.begin())
        {
            ll akt=*xd.begin();
            sum+=a[i]-akt;
            xd.erase(xd.find(akt));
            xd.insert(a[i]);
        }
        dp[i]=sum;
    }
    sum=0;
    xd.clear();
    for(int i=2*n+1;i<=3*n;i++)
    {
        sum+=a[i];
        xd.insert(a[i]);
    }
    dp2[2*n+1]=sum;
    multiset<ll>::iterator it;
    for(int i=2*n;i>=n+1;i--)
    {
        it=xd.end();
        it--;
        if(a[i]<*it)
        {
            ll akt=*it;
            sum+=a[i]-akt;
            xd.erase(xd.find(akt));
            xd.insert(a[i]);
        }
        dp2[i]=sum;
    }
    ll res=-1e18;
    for(int i=n;i<=2*n;i++) res=max(res,dp[i]-dp2[i+1]);
    cout<<res;
    return 0;
}


Measured memory_bytes: 10752
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

template <typename F>
void forComb(unsigned int n, unsigned int k, F f) {
  if (k == 0) {
    f(0);
    return;
  }
  int comb = (1 << k) - 1;
  while (comb < (1 << n)) {
    f(comb);

    int x = comb & -comb;
    int y = comb + x;
    comb = ((comb & ~y) / x >> 1) | y;
  }
}

template <typename F>
void forSubset(unsigned int s, F f) {
  unsigned int sub = s;
  do {
    f(sub);

    sub--;
    sub &= s;
  } while (sub != s);
}

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

  vector<int> x(N), y(N), p(N);
  rep(i, N) { cin >> x[i] >> y[i] >> p[i]; }

  vector<vector<int64_t>> vcost(N, vector<int64_t>(1 << N)),
      hcost(N, vector<int64_t>(1 << N));

  constexpr int64_t INF = numeric_limits<int64_t>::max();
  rep(i, N) {
    rep(s, 1 << N) {
      vcost[i][s] = abs(x[i]);
      hcost[i][s] = abs(y[i]);
      rep(j, N) {
        if ((s >> j) & 1) {
          chmin(vcost[i][s], (int64_t)abs(x[i] - x[j]));
          chmin(hcost[i][s], (int64_t)abs(y[i] - y[j]));
        }
      }
    }
  }

  irep(i, N) {
    int64_t result = INF;
    forComb(N, i, [&](int cmb) {
      forSubset(cmb, [&](int vert) {
        int hori = cmb ^ vert;
        int64_t dist = 0;
        rep(i, N) {
          dist += (int64_t)p[i] * min(vcost[i][vert], hcost[i][hori]);
        }
        chmin(result, dist);
      });
    });
    cout << result << "\n";
  }

  return 0;
}

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

using namespace std;

const int M = 1e3 + 3;
const int MOD = 1e9 + 7;
int n, m;
char t[M][M];
int dp[M][M], vis[M][M];

int solve (int i,int j) {
    vis[i][j] = 1;
    if (i == n-1 && j == m-1) return 1;
    if (i < 0 || i >= n || j < 0 || j >= m) return 0;
    int &ret = dp[i][j];
    if (ret != -1) return ret;
    ret = 0;
    if (t[i+1][j] == '.') ret = (ret + solve (i+1, j)) % MOD;
    if (t[i][j+1] == '.') ret = (ret + solve (i, j+1)) % MOD;
    return ret;
}

int main () {
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> t[i][j];
        }
    }
    memset (dp, -1, sizeof dp);
    cout << solve (0, 0);
}



Measured memory_bytes: 9216
#define _USE_MATH_DEFINES
#define MAX_N 1000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

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

static const double eps = 1e-8;

vector<int> split(string delim,string str){
	vector<int> res;
	str += delim;
	for(int i=0;i<str.size();i++){
		for(int j=1;i+j<=str.size();j++){
			if(str.substr(i,j).find(delim) != string::npos){
				int num = atoi(str.substr(i,j-1).c_str());
				if(str.substr(i,j-1).size() >0 ) res.push_back(num);
				i+=j-1;
				break;
			}
		}
	}

	return res;
}

int main(){
	string str;
	while(getline(cin,str)){
		vector<int> data = split(" ",str);
		if(data.size()==1 && data[0]==0) break;
		set<int>* dp = new set<int>[data.size()+1]; 

		dp[0].insert(0);
		for(int i=0;i<data.size();i++){
			if(data[i] == 1){
				for(set<int>::iterator it = dp[i].begin(); it != dp[i].end(); it++){
					if(*it+1 <= 21) dp[i+1].insert(*it+1);
					if(*it+11 <= 21) dp[i+1].insert(*it+11);
				}
			}
			else if(2 <= data[i] && data[i] <= 9){
				for(set<int>::iterator it = dp[i].begin(); it != dp[i].end(); it++){
					if(*it+data[i] <= 21) dp[i+1].insert(*it+data[i]);
				}
			}
			else{
				for(set<int>::iterator it = dp[i].begin(); it != dp[i].end(); it++){
					if(*it+10<= 21) dp[i+1].insert(*it+10);
				}
			}
		}

		int res=MAX_N;
		for(set<int>::iterator it = dp[data.size()].begin(); it != dp[data.size()].end(); it++){
			if(*it <= 21 && abs(*it-21) < abs(res-21)){
				res = * it;
			}
		}

		printf("%d\n",res == MAX_N ? 0 : res);

		delete[] dp;
	}
}

Measured memory_bytes: 0
num = list(range(1, 53))
n = int(input())
x = 0
cards = []

while x < n:
    have = input().split()
    have[1] = int(have[1])
    
    if have[0] == "S":
        cards.append(have[1])
        
    elif have[0] == "H":
        cards.append(have[1] + 13)
    
    elif have[0] == "C":
        cards.append(have[1] + 26)
        
    else:
        cards.append(have[1] + 39)
        
    x += 1
        
for i in num:
    if i not in cards:
        if i > 39:
            print(f"D {i - 39}")
            
        elif i > 26:
            print(f"C {i - 26}")
            
        elif i > 13:
            print(f"H {i - 13}")
            
        else:
            print(f"S {i}")


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type_a,class Type_b> bool chmax(Type_a &a,const Type_b &b){if(a<b){a=b;return true;}return false;}
template<class Type_a,class Type_b> bool chmin(Type_a &a,const Type_b &b){if(a>b){a=b;return true;}return false;}
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	llong h,w;
	cin>>h>>w;
	
	if(h==1 or w==1){
		cout<<1<<endl;
		return 0;
	}
	
	if(w%2==0){
		cout<<h*w/2<<endl;
	}else{
		cout<<h*(w/2)+(h+1)/2<<endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int a,n,k,h[100000],cnt=0;
	scanf("%d%d",&n,&k);
	for(a=0;a<n;a++){
		scanf("%d",&h[a]);
		if(h[a]>=k){
			cnt++;
		}
	}
	printf("%d",cnt);
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007

int a,b,c,n,k,x,y;

int main(){
  ll ans=0;
  cin >> n;
  string s;
  vector<ll> a(n);
  vector<ll> ss(10);
  REP(i,n){
    cin>>s;
    for(int j=0;j<10;j++){
      ss[j]=(ll)(s[j]-97);
    }
    sort(ss.begin(), ss.end());

    ll beki=1LL;
    for(int j=0;j<10;j++){
      a[i]+=ss[j]*beki;
      beki*=26LL;
    }
  } 
  
  sort(a.begin(), a.end());

  ll ma=a[0];
  ll same=1;
  for(int i=1;i<n;i++){
    if (a[i]!=ma){
      ans+=same*(same-1LL)/2LL;
      same=1LL;
      ma=a[i];
    }else{
      same++;
    }
  }
  ans+=same*(same-1LL)/2LL;

  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
N=int(input())
T=list(map(int,input().split()))
t=[1]
for i in range(1,N):
    if T[i]!=T[i-1]:
        t.append(1)
    else:
        t.append(T[i])
    if T[i]<T[i-1]:
        print(0)
        exit()
A=list(map(int,input().split()))
A=A[::-1]
a=[1]
for i in range(1,N):
    if A[i]!=A[i-1]:
        a.append(1)
    else:
        a.append(A[i])
    if A[i]<A[i-1]:
        print(0)
        exit()
A=A[::-1]
a=a[::-1]
#print(t)
#print(a)
M=max(A)

for i in range(N):
    if T[i]==M:
        if A[i]==M:
            break
        else:
            print(0)
            exit()

for i in range(N):
    if A[N-1-i]==M:
        if T[N-1-i]==M:
            break
        else:
            print(0)
            exit()
ans=1
mod=(10**9+7)
for i in range(N):
    ans*=min(t[i],a[i])
    ans%=mod
print(ans)

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

int main()
{
    int x, y, z;
	cin >> x >> y >> z;
	int t = y;
	y = x;
	x = t;
	int t2 = z;
	z = x;
	x = t2;
	cout << x << ' ' << y << ' ' << z << endl;
     return 0;   
}

Measured memory_bytes: 256
a, v = map(int,input().split())
b, w = map(int,input().split())
t=int(input())
if v<=w:
    print("NO")
else:
    time=abs(a-b)/(v-w)
    #print(time)
    if time<=t:
        print("YES")
    else:
        print("NO")

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

int main() {
    ll N, A, B; cin >> N >> A >> B;
    vector<ll> h(N);
    rep(i, N){
        cin >> h[i];
    }
    ll C = A-B;

    ll l = 0;
    ll r = 1e9;
    while(r-l > 1){
        ll m = (l+r)/2;

        vector<ll> h2(N);
        rep(i, N){
            h2[i] = h[i];
        }

        rep(i, N){
            h2[i] -= B*m;
        }
        ll cnt = 0;
        rep(i, N){
            if(h2[i] > 0){
                cnt += (h2[i]-1) / C + 1;
            }
        }
        if(cnt <= m){
            r = m;
        } else {
            l = m;
        }
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 4856
n = int(input())
num_list = input().split()

def bubbleSort(num_list, n):
    flag = 1
    count = 0
    while flag:
        flag = 0
        for j in range(n-1, 0, -1):
            if int(num_list[j]) < int(num_list[j-1]):
                a = num_list[j]
                b = num_list[j-1]
                num_list[j] = b
                num_list[j-1] = a
                flag = 1
                count += 1

    result = ' '.join(num_list)
    print(result)
    print(count)

bubbleSort(num_list, n)

Measured memory_bytes: 7736
#include <cstdio>
#include <iostream>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <math.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
// typedef pair<ll,ll> P;

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
vector<int>G[10010];
vector<int>c(10010,0);
int num[10010];
bool used[10010];
int now_c=0;
int dfs(int s){
    if(used[s]){
        return 0;
    }else{
        used[s]=true;
    }

    num[s]=c[now_c];
    now_c++;

    for(int i=0; i<G[s].size(); i++){
        dfs(G[s][i]);
    }
    return 0;
}


int main() {
    lli A,B,C,D;
    cin >> A >> B >> C >> D;

    cout << (B-A+1)- (B/C-(A-1)/C)
    -(B/D-(A-1)/D)+(B/lcm(C,D)-(A-1)/lcm(C,D))<< endl;
    return 0;
}

Measured memory_bytes: 512
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::prelude::BufRead;
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufReader, BufWriter, Write};
#[allow(unused_imports)]
use std::mem::swap;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
	let line = read_vector::<usize>();
	let (a, b) = (line[0], line[1]);
	let ans = if a > b { 2 * a - 1 } else if b > a { 2 * b - 1 } else { a + b };
	println!("{}", ans);
}
#[allow(dead_code)]
fn read<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    return buf.trim().parse().unwrap();
}

#[allow(dead_code)]
fn read_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::with_capacity(100);
    stdin().read_line(&mut buf).unwrap();
    return buf.split_whitespace().map(|s| s.parse().unwrap()).collect();
}

#[allow(dead_code)]
fn read_matrix<T>() -> Vec<Vec<T>>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    use std::io::prelude::*;
    let stdin = stdin();
    let mut reader = BufReader::with_capacity(100 * 1024, stdin);
    let mut line = String::with_capacity(100);
    let mut matrix: Vec<Vec<T>> = Vec::new();

    while reader.read_line(&mut line).unwrap() > 0 {
        matrix.push(
            line.trim()
                .split_whitespace()
                .map(|s| s.parse().unwrap())
                .collect(),
        );
        line.clear();
    }

    return matrix;
}

#[allow(dead_code)]
fn read_chars() -> Vec<char> {
    let stdin = stdin();
    let mut buf = String::new();
    let _bytes = stdin.read_line(&mut buf).unwrap();
    return buf.trim().chars().collect();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

string s, t;
int S, T;

bool match (int k) {
  REP(i,T) {
    if (t[i] != s[i+k] && s[i+k] != '?') {
      return false;
    }
  }
  return true;
}

string construct (int k) {
  string ans = s;
  REP(i,T) {
    ans[k+i] = t[i];
  }
  REP(i,S) {
    if (ans[i] == '?') {
      ans[i] = 'a';
    }
  }
  return ans;
}

int main () {
  cin >> s >> t;
  S = SZ(s);
  T = SZ(t);

  int k = -1;
  REP(i,S-T+1) {
    if (match(i)) {
      k = i;
      //break;
    }
  }

  if (k == -1) {
    cout << "UNRESTORABLE" << endl;
    return 0;
  }

  cout << construct(k) << endl;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, = map(int, input().split())
S = list(input().strip())

for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        print(i + 1, i + 2)
        exit()

for i in range(len(S) - 2):
    if S[i] == S[i + 2]:
        print(i + 1, i + 3)
        exit()

print(-1, -1)

Measured memory_bytes: 4340
#!/usr/bin/env python3

# input = stdin.readline


def main():
  A,B = map(int,input().split())
  def primeLst(x):
    acc = []
    f = 2
    while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
    if x != 1:
      acc.append(x)
    return acc
  a = set(primeLst(A))
  b = set(primeLst(B))
  if len(a) * len(b) == 0:
    ans = 1
  else:
    ans = len(a&b) + 1
  print(ans)
  return

if __name__ == '__main__':
  main()


Measured memory_bytes: 9144
/*https://atcoder.jp/contests/abc062/tasks/abc062_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int h, w;
	char a[200][200];
	cin >> h >> w;
	for (int i = 0; i < h + 2; i++)
	{
		for (int j = 0; j < w + 2; j++)
			a[i][j] = '#';
	}
	for (int i = 1; i < h + 1; i++)
	{
		for (int j = 1; j < w + 1; j++)
			cin >> a[i][j];
	}
	for (int i = 0; i < h + 2; i++)
	{
		for (int j = 0; j < w + 2; j++)
			cout << a[i][j];
		cout << endl;
	}

}

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

using namespace std;

#define int long long

const int MOD = 1000000007;
int fact[(1 << 20)], fact_r[(1 << 20)];

int elePow(int a, int b) {
	int res = 1;
    while(b > 0){
        if(b&1){
            res = res * a % MOD;
        }
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

int Combination(int n, int r) {
    if(r == 0) return 1;
	return fact[n] * fact_r[r] % MOD * fact_r[n - r] % MOD;
}

void Factorial(int n) {
    fact[0] = 1;
    for(int i = 1; i < n; ++i) {
        fact[i] = fact[i - 1] * i % MOD;
    }
    fact_r[n - 1] = elePow(fact[n - 1], MOD - 2);
    for(int i = n - 2; i >= 0; --i) {
        fact_r[i] = fact_r[i + 1] * (i + 1) % MOD;
    }
}

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

    int H, W, A, B;
    cin >> H >> W >> A >> B;

    Factorial(H + W);
    int res = 0;
    for(int i = B; i < W; ++i) {
        int n = Combination(H - A - 1 + i, i) * Combination(W + A - i - 2, W - i - 1) % MOD;
        res = (res + n) % MOD;
    }
    cout << res << endl;
    return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> Diameter(N);
   for (int i = 0; i < N; i++) {
    cin >> Diameter.at(i);
  }
  int Answer;
  Answer=1;
  int k;
  k=0;
  int difference;
    sort(Diameter.begin(), Diameter.end()); // {1, 2, 2, 5}
    reverse(Diameter.begin(), Diameter.end()); // {5, 2, 2, 1}
  while(k<N-1){
    int Big;
    Big=Diameter .at(k+1);
    int Small;
    Small=Diameter .at(k);
    difference=Big-Small;
    if(difference!=0){Answer++;}  
    k++;
}
  cout<<Answer<<endl;}



Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int d, n;
    cin >> d >> n;
    int d1 = 1;
    for (int i = 0; i < d; i++) {
        d1 *= 100;
    }
    int d2 = d1 * 100;

    int cnt = 0;
    int ans = 0;
    while (1) {
        for (int i = d1;; i += d1) {
            if (i % d2) {
                cnt++;
            }
            if (cnt == n) {
                ans = i;
                break;
            }
        }
        if (cnt == n)
            break;
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    ll h,w;
    cin >> h >> w;
    ll ans = 0;
    ll odd_line, even_line;
  
  	if (h != 1 && w != 1){
        odd_line = (w+1) / 2;
        even_line = w / 2;
        ans = odd_line * ((h+1)/2) + even_line * (h / 2);
    }
  
    else ans = 1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    cout << min(N*A,B)<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int>ii;
typedef vector<ii>vii;
#define forn(i,n) for(ll i=0;i<n;i++)
#define wez(n) ll (n); cin>>(n);
#define w(t) while(t--)
#define setmax(a,b) (a)=max((a),(b))
#define setmin(a,b) (a)=min((a),(b))
#define pb push_back
#define mp make_pair
#define pie 3.1415926535897;
#define inf 1000000000;
#define outa(a,e) forn(i,e) cout << a[i] << (i==e-1?'\n':' ')
#define oute(n) cout<<n<<"\n"
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,d;
    cin>>n>>d;
    int a[n][d];
    forn(i,n){
        forn(j,d){
            cin>>a[i][j];
        }
    }
    int cnt=0;
    forn(i,n){
        for(int j=i+1;j<n;j++){
            double sum=0;
            forn(k,d){
                int temp=a[i][k]-a[j][k];
                temp=temp*temp;
                sum+=temp;
            }
            sum=sqrt(sum);
            if(floor(sum)==ceil(sum)){
                cnt++;
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256