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

int getDigits(long long x){
    if(x/10 == 0) return 1;
    return getDigits(x/10) + 1;
}

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

    int ans = 1000000000;
    for (long long a = 1; a <= sqrt(N); a++)
    {
        if(N%a == 0 ){
            long long b = N/a;
            int fab = max(getDigits(a), getDigits(b));
            ans = min(ans, fab);
        }
    }

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


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

int main() {
	int n;
	while(std::cin >> n){
		if(!n){
			return 0;
		}
		std::vector<std::pair<int, long long> > sales;
		while(n--){
			int id, unit, num;
			std::cin >> id >> unit >> num;
			int i = 0;
			for(; i < sales.size(); i++){
				if(sales.at(i).first == id){
					sales.at(i).second += (long long)unit * num;
					break;
				}
			}
			if(i == sales.size()){
				std::pair<int, long long> worker;
				worker.first = id;
				worker.second = (long long)unit * num;
				sales.push_back(worker);
			}
		}
		bool found = false;
		for(int i = 0; i < sales.size(); i++){
			if(sales.at(i).second >= 1000000){
				found = true;
				std::cout << sales.at(i).first << std::endl;
			}
		}
		if(!found){
			std::cout << "NA" << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1232
N = int(input())
S = list(input())

S_n_1 = S[0]
resList = list()
for i in range(1, N):
    S_n = S[i]
    if S_n != S_n_1:
        resList.append(S_n_1)
    S_n_1 = S_n
resList.append(S_n_1)
print(len(resList))

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {
  
  int h,w;
  cin >> h >> w;
  
  vector<string> s(h);
  
  for ( int i = 0; i < h; i++){
    cin >> s[i];
    s[i] = '#' + s[i] + '#';
  }
  
  for ( int i = 0; i < w + 2; i++){
    cout << '#';
  }
  cout << endl;
  
  for ( int i = 0; i < h; i++){
    cout << s[i] << endl;
  }
  
  for ( int i = 0; i < w + 2; i++){
    cout << '#';
  }
  cout << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
using P=pair<int,int>;
using ll=long long;
int main(){
    string s,t;
    cin>>s>>t;
    if(s==t.substr(0,t.size()-1))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	int n,a[100] = {0};

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

	sort(a,a+n);

	cout << a[n-1] - a[0] << endl;

	return 0;
}

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

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	int N;
	LL A, B;
	cin >> N >> A >> B;
	vector<LL> X(N);
	rep(i,N) cin >> X[i];
	LL ans=0;
	vector<LL> dist(N-1);
	rep(i,N-1) dist[i]=min((X[i+1]-X[i])*A,B);
	rep(i,N-1) ans+=dist[i];
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4828
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int a, b, q;

PLL nodes(vector<ll>& v, ll n) {
  auto it = upper_bound(v.begin(), v.end(), n);
  ll s, t;
  if(it == v.end()) {
    s = *(it - 1);
    t = -1;
  } else if(it == v.begin()) {
    t = *it;
    s = -1;
  } else {
    t = *it;
    s = *(it - 1);
  }

  return PLL(s, t);
}

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

  cin >> a >> b >> q;

  vector<ll> s(a);
  vector<ll> t(b);

  REP(i, a) cin >> s[i];
  REP(i, b) cin >> t[i];

  REP(i, q) {
    ll n;
    cin >> n;

    PLL s_n = nodes(s, n);
    PLL t_n = nodes(t, n);

    ll ans = LLINF;

    if(s_n.first != -1 && t_n.first != -1) {
      ans = min(ans, max(n - s_n.first, n - t_n.first));
    }
    if(s_n.first != -1 && t_n.second != -1) {
      ll t = min(n - s_n.first, t_n.second - n) * 2 + max(n - s_n.first, t_n.second - n);
      ans = min(ans, t);
    }
    if(s_n.second != -1 && t_n.first != -1) {
      ll t = min(s_n.second - n, n - t_n.first) * 2 + max(s_n.second - n, n - t_n.first);
      ans = min(ans, t);
    }
    if(s_n.second != -1 && t_n.second != -1) {
      ans = min(ans, max(s_n.second - n, t_n.second - n));
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 4732
#include <atcoder/maxflow>
#include <iostream>

using namespace std;
using namespace atcoder;

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

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

    /**
     * generate (s -> even grid -> odd grid -> t) graph
     * grid(i, j) correspond to vertex (i * m + j)
     **/
    mf_graph<int> g(n * m + 2);
    int s = n * m, t = n * m + 1;

    // s -> even / odd -> t
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (grid[i][j] == '#') continue;
            int v = i * m + j;
            if ((i + j) % 2 == 0) {
                g.add_edge(s, v, 1);
            } else {
                g.add_edge(v, t, 1);
            }
        }
    }

    // even -> odd
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if ((i + j) % 2 || grid[i][j] == '#') continue;
            int v0 = i * m + j;
            if (i && grid[i - 1][j] == '.') {
                int v1 = (i - 1) * m + j;
                g.add_edge(v0, v1, 1);
            }
            if (j && grid[i][j - 1] == '.') {
                int v1 = i * m + (j - 1);
                g.add_edge(v0, v1, 1);
            }
            if (i + 1 < n && grid[i + 1][j] == '.') {
                int v1 = (i + 1) * m + j;
                g.add_edge(v0, v1, 1);
            }
            if (j + 1 < m && grid[i][j + 1] == '.') {
                int v1 = i * m + (j + 1);
                g.add_edge(v0, v1, 1);
            }
        }
    }

    cout << g.flow(s, t) << endl;

    auto edges = g.edges();
    for (auto e : edges) {
        if (e.from == s || e.to == t || e.flow == 0) continue;
        int i0 = e.from / m, j0 = e.from % m;
        int i1 = e.to / m, j1 = e.to % m;

        if (i0 == i1 + 1) {
            grid[i1][j1] = 'v';
            grid[i0][j0] = '^';
        } else if (j0 == j1 + 1) {
            grid[i1][j1] = '>'; grid[i0][j0] = '<';
        } else if (i0 == i1 - 1) {
            grid[i0][j0] = 'v';
            grid[i1][j1] = '^';
        } else {
            grid[i0][j0] = '>'; grid[i1][j1] = '<';
        }
    }

    for (int i = 0; i < n; i++) {
        cout << grid[i] << endl;
    }

    return 0;
}

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


typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;


#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define asd cout << "ok" << endl;


#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define trav(it, m) for(auto it = m.begin(); it!= m.end(); it++)

const int MOD = 1e9 + 7;
const ll INF = 1e19;
const ld PI = acos((ld)-1);
const int MX = 2e5 +5;
const char nl = '\n';


int main(){

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int r, c; cin >> r >> c;
  char a[r][c];
  for(int i = 0; i < r; i++)
    for(int j = 0; j < c; j++)
      cin >> a[i][j];
  for(int i = 0; i < r; i++){
    bool ok = 0;
    for(int j = 0 ; j < c; j++){
      if(a[i][j] == '#')
        ok = 1;
    }
    if(!ok)
    {
      for(int j = 0 ; j< c; j++)
        a[i][j] = 'x';
    }
  }

  for(int i = 0; i < c; i++){
      bool ok = 0;
    for(int j = 0 ; j < r; j++){
      if(a[j][i] == '#')
      ok =1;
    }
    if(!ok){
      for(int j = 0; j < r; j++)
      {
        a[j][i] = 'x';
      }
    }
  }

  for(int i= 0;i <r; i++){
      bool ok =0;
    for(int j=0; j < c; j++){
      if(a[i][j] != 'x')
      {
        cout << a[i][j];
        ok = 1;
      }

    }
    if(ok)
    cout << nl;
  }



  return 0;
}


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

int main(){
    
    int n;
    cin >> n;
    vector<int> p(n);
    int maxp = 0;
    int sum = 0;
    for(int i=0; i<n; i++){
        cin >> p.at(i);
        sum += p.at(i);
        if(p.at(i) > maxp){
            maxp = p.at(i);
        }
    }
    cout << (sum-maxp) + maxp/2 << endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  double a, b, x;
  cin >> a >> b >> x;
  double s = x / a;
  double ans;
  if (s >= a * b / 2.0) {
    double h = 2.0 * (a * b - s) / a;
    ans = atan2(h, a);
  } else {
    double w = 2 * s / b;
    ans = atan2(b, w);
  }
  double PI = acos(-1);
  double deg = ans / (2 * PI) * 360;
  printf("%.10f\n", deg);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i=0 ; i<n ; i++) cin >> a[i];
  long long res1 = 0, res2 = 0;
  long long sum1 = 0, sum2 = 0;

  for (int i=0 ; i<n ; i++) {
    sum1 += a[i];
    sum2 += a[i];
    if (i%2 == 0 && sum1 <= 0) {
      res1 += abs(sum1) + 1;
      sum1 = 1;
    } else if (i%2 == 1 && sum1 >= 0) {
      res1 += abs(sum1) + 1;
      sum1 = -1;
    }

    if (i%2 == 0 && sum2 >= 0) {
      res2 += abs(sum2) + 1;
      sum2 = -1;
    } else if (i%2 == 1 && sum2 <= 0) {
      res2 += abs(sum2) + 1;
      sum2 = 1;
    }
  }
  cout << min(res1, res2) << endl;
}


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

ll a,b,c,d,ans;

ll gcm(ll a,ll b)
{
        if(b==0)return a;
        return gcm(b,a%b);
}

ll lcm(ll a,ll b)
{
        return a/gcm(a,b)*b;
}

main()
{
        cin>>a>>b>>c>>d;
        a--; b;
        a=a-a/c-a/d+a/lcm(c,d);
        b=b-b/c-b/d+b/lcm(c,d);
        cout<<b-a<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python

numbers = raw_input().split()

A = int(numbers[0])
B = int(numbers[1])

if A == B :
   print "Draw"
elif A == 1:
   print "Alice"
elif B == 1:
   print "Bob"
elif A > B:
   print "Alice"
elif B > A:
   print "Bob"

Measured memory_bytes: 2568
<?php
$cards = array();
 
foreach (array('S', 'H', 'C', 'D') as $mark) {
    $cards[$mark] = array_reduce(range(1, 13), function ($carry, $item) { $carry[$item] = false; return $carry; }, array());
}
 
fscanf(STDIN, "%d", $n);
for ($i = 0; $i < $n; $i++) {
    fscanf(STDIN, "%s %d", $s, $x);
 
    $cards[$s][$x] = true;
}
 
foreach ($cards as $m => $nums) {
    foreach ($nums as $i => $found) {
        if ($found) continue;
 
        echo "$m $i\n";
    }
}

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

vector<int> buf;
vector<int> fn;
void dfs(int i, int size, int str, int end, int N){
    if(i==size){
        int ans = pow(buf[0],2)+pow(buf[1],2)+pow(buf[2],2)+buf[0]*buf[1]+buf[1]*buf[2]+buf[2]*buf[0];
        if( ans <= N ){
            fn.at(ans) = fn.at(ans)+1; 
        }
    }
    else{
        for(int j=str; j<=end; j++){
            buf[i] = j;
            dfs(i+1, size, str, end, N);
        }
    }
}
int main(){
	int N;
    cin >> N;

    int size=3;
    int str=1;
    int end;
    end = pow(N,0.5);

    fn.resize(N+1,0);
    buf.resize(size);
    dfs(0,size,str,end,N);

    for(int i=1; i<=N; i++){
        cout<< fn.at(i) << endl;
    }
}


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

int main() {
	string s; cin >> s;
	string t; cin >> t;
	
	for(int i=0; i<s.length()+1; i++) {
		if (s==t) {
			cout << "Yes" << endl;
			return 0;
		}
		s = s.substr(1,s.length()-1)+s[0];
	}
	
	cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

LL mod = 998244353;

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

  LL A, B;
  cin >> A >> B;
  if(B%A==0){
    cout << A + B << endl;
  }else{
    cout << B - A << endl;
  }
}


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

const int INF = 1e+8;
// s[y][x] := (x,y) ツづ可つィツつ「ツづ?つ?づゥツ青ウツ陛サツ形ツづ個氾板債? ツ可スツづ?置ツつゥツづェツづ?つ「ツづ按つ「ツづ?つォツづ?1
int s[500][500];

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

// ツ渉可甘コツ可サ
void init(){
	for(int y=0 ; y < 500 ; y++ ){
		for(int x=0 ; x < 500 ; x++ ){
			s[y][x] = -1;
		}
	}
}

// ツ青ウツ陛サツ形 now ツづー ツ青ウツ陛サツ形 id ツづ個療猟づ可置ツつュ(ツ古シツつォ d)
void search(int id, int d, int now){
	for(int y=0 ; y < 500 ; y++ ){
		for(int x=0 ; x < 500 ; x++ ){
			if( s[y][x] == id ){
				int mx = x + dx[d];
				int my = y + dy[d];
				s[my][mx] = now;
				return;
			}
		}
	}
}

int main(){
	int N;
	while( cin >> N , N ){
		// ツ渉可甘コツ可サ
		init();
		
		// 0 ツ氾板づ個青ウツ陛サツ形ツづーツ置ツつュ
		s[250][250] = 0;
		for(int i=1 ; i < N ; i++ ){
			int n, d;
			cin >> n >> d;
			search( n , d , i );
		}
		int min_x, min_y, max_x, max_y;
		min_x = min_y = INF;
		max_x = max_y = 0;
		for(int y=0 ; y < 500 ; y++ ){
			for(int x=0 ; x < 500 ; x++ ){
				if( s[y][x] >= 0 ){
					max_x = max( max_x , x );
					max_y = max( max_y , y );
					min_x = min( min_x , x );
					min_y = min( min_y , y );
				}
			}
		}
		cout << (max_x - min_x + 1) << " " << (max_y - min_y + 1) << endl;
	}
}

Measured memory_bytes: 1840
#![allow(unused_imports)]

use std::cmp::{max, min};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let (n, k): (usize, usize) = input_two();
    let mut ans = vec![true; n];
    for i in 0..k {
        let d: usize = input().unwrap();
        for tr in input_vec::<usize>().unwrap().iter() {
            ans[tr - 1] = false;
        }
    }

    let ans = ans.iter().filter(|x| **x).count();
    println!("{}", ans);
}

pub fn input<T: FromStr>() -> Result<T, T::Err> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    Ok(buf.trim().parse().ok().unwrap())
}

pub fn input_vec<T: FromStr>() -> Result<Vec<T>, T::Err> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    Ok(buf
        .trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>())
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


Measured memory_bytes: 2140
#include<stdio.h>
#define ROW 100
#define COLUMN 100
int main()
{

  int row,column,mat[ROW][COLUMN],i,j,Sum_of_column[COLUMN]={},Sum_of_row[ROW] = {},sum=0;

  scanf("%d %d",&row,&column);

  for(i = 0 ; i < row ; i++ )
    {
      for(j = 0 ; j < column ; j++)
	{

	  scanf("%d" ,&mat[i][j] );
	  	  
	}
      
    }

  for(i = 0 ; i < row ; i++)
    {
      for( j = 0 ; j < column ; j++)
	{
	  printf("%d ",mat[i][j]);

	  Sum_of_row[i]    += mat[i][j];
	  Sum_of_column[j] += mat[i][j];

	}
      
      printf("%d\n",Sum_of_row[i]);
      Sum_of_row[i] = 0;
     
    }

  for(j = 0 ; j < column ; j++)
    {
      printf("%d " ,Sum_of_column[j]) ;
      
      sum += Sum_of_column[j];
    }

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

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

int main() {
    string S;
    cin >> S;

    int ans = 0;
    rep(i, S.size()) {
        rep(j, S.size() - i) {
            bool is_acgt = false;
            string sub = S.substr(i, j + 1);
            for (char c : sub) {
                if(c == 'A' || c == 'C' || c == 'G' || c == 'T') {
                    is_acgt = true;
                }
                else {
                    is_acgt = false;
                    break;
                }
            }
            if (is_acgt) ans = max(ans, int(sub.size()));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    int N;
    cin >> N;
    vint A(N), B(N);
    vector<pair<int, int>> BA(N);
    rep(i, N)
    {
        cin >> A[i] >> B[i];
        BA[i] = {B[i], A[i]};
    }
    sort(all(BA));
    int nowtime = 0;
    bool ok = true;
    rep(i, N)
    {
        if (nowtime + BA[i].second > BA[i].first)
        {
            ok = false;
            break;
        }
        nowtime += BA[i].second;
    }
    ok ? cout << "Yes" : cout << "No";
    return 0;
}

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

 

int dp[100001];

 
int goEasy( int i, vector<int> &v ){
    int n = v.size();
    if( i == n-1 )return 0;
    if( dp[i] != -1 )return dp[i];
    int ans = LLONG_MAX;
    for( int j = i+1; j <= n-1 && j <= i+2; j++ ){
        ans = min(ans, goEasy(j,v) + abs(v[i] - v[j]));
    }
    return dp[i] = ans;
}

int32_t main(){
    int t;
    cin>>t;
    memset(dp,-1,sizeof(dp));
    vector<int> h(t);
    for(int i=0;i<t;i++){
        cin>>h[i];
    }
    cout<<goEasy(0,h)<<endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

//最大公約数の計算(ユークリッドの互除法)
long long int gcd(long long int a, long long int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        ans = gcd(ans, a);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f
using namespace std;

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int ans=1e4;
    ///这里补充一下的我的错误理解，就是如果遇到不同的就跳出，这不对，万一剩下的还有很多相同的呢
    for(int i=0; i<=s1.length()-s2.length(); i++)
    {
        int num=0;
        for(int j=0; j<s2.length(); j++)
        {
            if(s1[i+j]!=s2[j])
                num++;
        }
        ans=min(ans,num);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
import sys

n, k = map(int, input().split())
P = int(1e9+7)


def cmb(n, r, P):
    r = min(r, n - r)
    inv_y = 1
    for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
    inv_y = pow(inv_y, P - 2, P)
    x = 1
    for i in range(n - r + 1, n + 1):
        x = x * i % P
    return (x * inv_y) % P


if k >= n:
    print(cmb(2*n-1, n, P))
    sys.exit()
if k == 1:
    print((n * n - 1) % P)
    sys.exit()
ans = 1
comb1 = 1
comb2 = 1
for i in range(1, k + 1):
    iinv = pow(i, P-2, P)
    comb1 = ((comb1 * (n - i)) * (iinv)) % P
    comb2 = ((comb2 * (n - i + 1)) * (iinv)) % P
    ans = (ans + comb1*comb2) % P
print(ans)


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

#define N 200005
#define maxN 1000000007
#define PI 3.14159265358979
#define bb __builtin_popcount
#define ll long long
int s;
int a[N];
void solve() {
    for (int i = 1; i <= 3; i++) cin >> a[i];
    sort(a + 1, a + 4);
    cout << a[3] * 10 + a[2] + a[1];
}
int main() {
    //freopen("main1.in", "r", stdin);
    //freopen("main.in", "w", stdout);
    //freopen("main.out", "w", stdout);
    solve();
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}
///Hamita


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - The Number of Even Pairs
            var line = ReadLine();
            var N = line[0];
            var M = line[1];

            Console.WriteLine(Count(N) + Count(M));
        }

        static int Count(int n)
        {
            return n * (n - 1) / 2;
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 11220
require 'matrix'

n, m, x = gets.split.map(&:to_i)
c = Array.new(n, 0)
a = Array.new(n){Array.new(m, 0)}
a = Matrix.zero(n, m)
n.times do |i|
  b = gets.split.map(&:to_i)
  c[i] = b[0]
  1.upto(m) do |j|
    a[i, j - 1] = b[j]
  end
end
m.times do |j|
  if a.column(j).to_a.sum < x
    puts "-1"
    exit
  end
end
min = Float::INFINITY
1.upto(2 ** n - 1) do |bit|
  ans = 0
  sum = 0
  m.times do |j|
    sum = 0
    n.times do |i|
      if bit[i] == 1
        sum += a[i, j]
      end
    end
    break if sum < x
  end
  if sum >= x
    n.times do |i|
      if bit[i] == 1
        ans += c[i]
      end
    end
    min = ans if min > ans
  end
end
puts min

Measured memory_bytes: 15168
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5;

int main(){
	lli K;
	cin>>K;
	lli A[MAX+1];
	rep1(i,K)cin>>A[i];
	A[0]=1;
	
	bool flag=true;
	if(A[K]!=2) flag=false;
	lli Pl[MAX+1],Pr[MAX+1];
	Pl[K]=2;
  	Pr[K]=2;
	for(int i=K-1;i>=0;i--){
		lli l=Pl[i+1], r=Pr[i+1]+A[i+1]-1;
		lli lq=(l-1)/A[i]+1, rq=r/A[i];
		if(lq>rq){
			flag=false;
			break;
		}
		else{
			Pl[i]=lq*A[i];
			Pr[i]=rq*A[i];
		}
	}
	if(!flag)cout<<-1;
	else cout<<Pl[0]<<" "<<Pr[0];
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#define MAX 5010
using namespace std ;

int dp[MAX][MAX];
char c[MAX];
int n;

int calDP(int i, int j){
    if(c[i]==c[j]){
        if(i+dp[i+1][j+1]<j) dp[i][j]=dp[i+1][j+1]+1;
        else dp[i][j]=dp[i+1][j+1];
    }
    return dp[i][j];
}

int main(){
    cin>>n>>c;
    vector< vector<int> > same(n);
    for(int i=n-1;i>=1;i--) for(int j=i-1;j>=0;j--) if(c[i]==c[j]) same[i].push_back(j);
    int ans=0;
    for(int j=n-1;j>=1;j--){
        for(int i:same[j]){
            ans=max(ans, calDP(i, j));
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 158336
s=input()
left=[0 for c in s+" "]
right=[0 for c in s+" "]


cnt=0
for i in range(len(s)):
    if s[i]=="<":
        cnt+=1
        left[i+1]=cnt
    else:
        cnt=0

cnt=0
for i in range(len(s)):
    if s[len(s)-i-1]==">":
        cnt+=1
        right[len(s)-i-1]=cnt
    else:
        cnt=0

ans=0
for i in range(len(left)):
    ans+=(max(left[i],right[i]))

print(ans)

Measured memory_bytes: 27292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846264338327950L
#define MOD 1000000007
#define sz 100005
ll inf = 1e16;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
ll dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  ll n,m,k;
  cin>>n>>m>>k;
  ll a[n];
  ll b[m];
  for(ll i=0;i<n;i++)
    cin>>a[i];
  for(ll j=0;j<m;j++)
    cin>>b[j];
  ll ans=0;
  ll prefix[m];
  ll sum=0;
  ll ind=0;
  for(ll i=0;i<m;i++)
  {
    sum=sum+b[i];
    prefix[i]=sum;
  }
  ll d1=0;
  for(ll i=0;i<n;i++)
  {
    if(d1+a[i]<=k)
    {
      ans=max(ans,i+1);
      d1=d1+a[i];
      ind=i;
    }
    else
    break;
  }
  d1=0;
  for(ll i=0;i<m;i++)
  {
    if(d1+b[i]<=k)
    {
      ans=max(ans,i+1);
      d1=d1+b[i];
    }
    else
    break;
  }
  ll c=0;
  for(ll i=0;i<=ind;i++)
  {
    if(c+a[i]<=k)
    {
      c=c+a[i];
      ll j=upper_bound(prefix,prefix+m,k-c)-prefix;
      if(j==m)
      {
        ans=max(ans,i+1+m);
      }
      else if(prefix[j]<=k-c)
      {
        ans=max(ans,i+j+2);
      }
      else if(prefix[j]>k-c)
      {
        ans=max(ans,i+1+j);
      }
      //cout<<i<<" "<<j<<'\n';
    }
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 8368
import math

n,m=map(int,input().split())
mod = 1000000007

if m==1:
    print(1)
    exit()

dic = {}
p = 2
while True:
    if m==1:
        break
    if p > math.floor(math.sqrt(m))+1:
        if dic.get(m) is None:
            dic[m] = 1
        else:
            dic[m] += 1
        break
    if m % p == 0:
        if dic.get(p) is None:
            dic[p] = 1
        else:
            dic[p] += 1
        m = m//p
        p=1
    p+=1

def pow(n,e):
    ret=1
    b=n
    while e > 0:
        if e % 2 == 1:
            ret = ret * b % mod
        b = b * b % mod
        e = e//2
    return ret
    
def inv(n):
    return pow(n,mod-2)

def nck(n,k):
    ret = 1
    for i in range(1,k+1):
        ret *= (n-i+1) % mod
        ret %= mod
        ret *= inv(i) % mod
        ret %= mod
    return ret
    
ret=1
for x in dic.keys():
    ret = (ret * nck(n+dic[x]-1,min(n-1,dic[x]))) % mod

print(ret)


Measured memory_bytes: 3064
let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let n = read_int () in
  let tbl = Hashtbl.create ~random:true n in
  for _ = 0 to n - 1 do
    match split_on_char ' ' (read_line ()) with
    | ["insert"; s] -> Hashtbl.add tbl s ()
    | ["find"; s] -> Printf.printf "%s\n" (if Hashtbl.mem tbl s then "yes" else "no")
    | _ -> assert false
  done

Measured memory_bytes: 43972
from heapq import heappush, heappop, heapify
N = int(input())
a = list(map(int, input().split()))
ans_list = []
def red_sum():
  red = sum(a[:N])
  pqr = a[:N]
  heapify(pqr)
  ans_list.append(red)
  for i in range(N, 2*N):
    heappush(pqr, a[i])
    red += a[i]-heappop(pqr)
    ans_list.append(red)

def blue_sum():
  blue = sum(a[2*N:])
  pqb = [-a[i] for i in range(2*N, 3*N)]
  heapify(pqb)
  ans_list[N] -= blue
  for i in range(2*N-1, N-1, -1):
    heappush(pqb, -a[i])
    tmp = heappop(pqb)
    blue += a[i]+tmp
    ans_list[i-N] -= blue

red_sum()
blue_sum()
print(max(ans_list))

Measured memory_bytes: 37212
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iostream>
#include <map>
#include <unordered_map>

using namespace std;
typedef long long ll;

const ll MOD = 1E+09 + 7;

const int MAX_N = 100000;

ll N;

ll modPow(ll x, ll a);

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

    cin >> N;

    unordered_map<ll, int> mp;

    for (int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        if (mp.count(a)) {
            mp[a]++;
        } else {
            mp.insert(make_pair(a, 1));
        }
    }

    bool isPossible = true;

    for (ll j = !(N & 1); j <= N - 1; j += 2) {
        if (mp.count(j)) {
            if (mp[j] != 2 && !(j == 0 && mp[j] == 1)) {
                isPossible = false;
                break;
            }
        } else {
            isPossible = false;
            break;
        }
    }

    ll ans;

    if (isPossible) {
        ans = modPow(2, N / 2);
    } else {
        ans = 0;
    }

    cout << ans << "\n";

    return 0;
}

ll modPow(ll x, ll a)
{
    long long ret = 1;
    x %= MOD;
    while (0 < a)
    {
        if (a % 2 == 0) {
            x = (x * x) % MOD;
            a /= 2;
        }
        else {
            ret = (ret * x) % MOD;
            --a;
        }
    }
    return ret;
}

Measured memory_bytes: 6592
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  rep2(k, 1, n+2){
    ll add = (k)*(k-1)/2;
    if(add < n) continue;
    if(add > n) break;
    cout << "Yes" << endl;
    cout << k << endl;

    cout << k-1;
    int nxo = 1;
    rep(i, k-1){
      cout << " " << nxo;
      nxo += i+1;
    }
    cout << endl;

    cout << k-1;
    nxo = 1;
    rep(i, k-1){
      cout << " " << nxo;
      nxo += i+2;
    }
    cout << endl;

    int st = 2;
    rep(i, k-2){
      cout << k-1;
      int out = st;
      int nxi = i;
      rep(j, k-1){
        cout << " " << out;
        if(j < i+1)out++;
        else{
          out += nxi+2;
          nxi++;
        }
      }
      st += i+2;
      cout << endl;
    }
    return 0;
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
#define MAX  500000
#define SENTINEL  2000000000

int cnt;
int L[MAX/2 + 2], R[MAX/2 + 2];

void Merge(int A[], int n, int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++) L[i] = A[left + i];
    for (int i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++)
    {
        cnt++;
        if (L[i] <= R[j])
        {
            A[k] = L[i++];
        }
        else
        {
            A[k] = R[j++];
        }
    }
}

void MSort(int A[], int n, int left, int right)
{
    if (left + 1 < right)
    {
        int mid = (left + right) / 2;
        MSort(A, n, left, mid);
        MSort(A, n, mid, right);
        Merge(A, n, left, mid, right);
    }
}

int main()
{
    int A[MAX], n, i;
    cin >> n;
    for (i = 0; i < n; i++) cin >> A[i];
    
    MSort(A, n, 0, n);

    for (i = 0; i < n; i++)
    {
        if (i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;

    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 6976
#include <iostream>
using namespace std;
int main(){
	int n, m, x;
	cin >> n >> m >> x;
	int a[m];
	int l=0, r=0;
	for(int i=0; i<m; i++){
		cin >> a[i];
		if(a[i]<x) l++;
		else r++;
	}
	cout << min(l, r);
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define f first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define ull unsigned long long

using namespace std;
const int N = (int)(1e5 + 123);
const int INF = (int)(1e9 + 7);

int dp[N] , a[N]; 

int main() {
	int n , k;
	cin >> n >> k;
	for (int i=1; i<=n; i++) {
		cin >> a[i];
	}                     
	for (int i=2; i<=n; i++) {
		dp[i] = INF;
	}                    
	for (int i=1; i<n; i++) {
		int rep = 1;
		while (i+rep <= n && rep <= k) {
			dp[i+rep] = min(dp[i+rep] , dp[i]+abs(a[i+rep] - a[i]));
			rep++;
		}
	}
	cout <<dp[n];
	return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define REP(i, vec) for(auto i = vec.begin(); i != vec.end(); ++i)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T> inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T> inline T LCM(T a, T b) { return (a + (b - 1)) / b; }

int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	list<char> a;
	string s;
	cin >> s;

	rep(i, s.size()) {
		a.push_back(s[i]);
	}

	int q;
	cin >> q;
	int cnt = 0;
	rep(i, q) {
		int p;
		cin >> p;

		if (p == 1) cnt++;
		else {
			int f;
			char c;
			cin >> f >> c;
			if (f == 1) {
				if (cnt % 2 == 0) a.push_front(c);
				else a.push_back(c);
			}
			else {
				if (cnt % 2 == 0) a.push_back(c);
				else a.push_front(c);
			}
		}
	}

	if (cnt % 2 == 1) reverse(ASC(a));

	REP(i, a) {
		cout << *i;
	}
	cout << endl;
}


Measured memory_bytes: 9984
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <string>
#define llint long long
#define inf 1e9

using namespace std;
typedef pair<llint, llint> P;

string s;
llint x;

int main(void)
{
  cin >> s >> x;
  llint ans = s[0]-'0';
  for(int i = 2; i < s.size(); i+=2){
    if(s[i-1] == '+') ans += s[i]-'0';
    else ans *= s[i]-'0';
  }

  llint ans2 = 0, mul = 1;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '+'){
      ans2 += mul;
      mul = 1;
    }
    else if(s[i] != '*') mul *= s[i]-'0';
  }
  ans2 += mul;

  if(ans == x){
    if(ans2 == x) cout << "U" << endl;
    else cout << "L" << endl;
  }
  else{
    if(ans2 == x) cout << "M" << endl;
    else cout << "I" << endl;
  }
  return 0;
}



Measured memory_bytes: 3228
#include <iostream>
#include <fstream>
#include <vector>
#include <limits>
using  namespace std;

int main(){

    //long long min = numeric_limits<long long>::max();

    long long n, k;

    cin >> n >> k;

    long long t = n%k;

    long long e;

    if (abs(t - k) < n%k){
        cout << abs(t - k) << endl;
    } else {
        cout << n%k << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	A = getlist()
	X = 10 ** 18
	ans = 1
	if 0 in A:
		print(0)
		return

	for i in range(N):
		ans *= A[i]
		if ans > X:
			print(-1)
			return

	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 87500
#include <iostream>

using namespace std;
enum
{
    x10 = 10000,
    x5 = 5000,
    x1 = 1000,
};
bool check(int x, int y, int z, int N, long Y)
{
    bool isPositive = ((x >= 0) && (y >= 0) && (z >= 0));
    bool checkN = ((x + y + z - N) == 0);
    bool checkY = ((x * x10 + y * x5 + z * x1 - Y) == 0);

    return isPositive && checkN && checkY;
}

void calcY(int &x, int &y, int &z, int N, long Y)
{
    for (x = 0; x <= N; x++)
    {
        for (y = 0; y <= N; y++)
        {
            z = N - x - y;
            if (check(x, y, z, N, Y))
                return;
        }
    }
}

int main()
{
    int N;
    long Y;
    cin >> N >> Y;
    int x, y, z;
    x = -1;
    y = -1;
    z = -1;

    calcY(x, y, z, N, Y);

    if (check(x, y, z, N, Y))
        cout << x << " " << y << " " << z;
    else
        cout << -1 << " " << -1 << " " << -1;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

D,T, S = LI()

if S * T >= D:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 10920
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back


#define L_B lower_bound
#define U_B upper_bound

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf (1000*1000*1000+5)
#define mod 1000000007
#define maxn 100009
#define maxr 100009

void solve()
{
	ll n,x;
	rl2(n,x);
	VL arr(n);
	fr(i,0,n)
		rl(arr[i]);
	VL bob(n+1,0);
	fr(i,1,n+1)
	{
		bob[i]=bob[i-1]+arr[i-1];
	}
	VL::iterator low;
	low=L_B(ALL(bob),x);
	ll ans=low-bob.begin();
	if(x==*low)
		ans++;
	cout<<ans<<endl;
	return;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 256
min_list = []
while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    s.sort(reverse=True)
    min1 = s[0] - s[1]
    for i in range(n-1):
        min1 = min(min1, s[i]-s[i+1])
    min_list.append(min1)

for i in range(len(min_list)):
    print(min_list[i])



Measured memory_bytes: 5640
n = int(input())
dic = {}
for i in range(n):
  dic[i+1] = int(input())

visited = set([1])
i = 1
ans = 1
while True:
  if dic[i] == 2:
    print(ans)
    break
  elif dic[i] in visited:
    print(-1)
    break
  visited.add(dic[i])
  i = dic[i]
  ans += 1

Measured memory_bytes: 22240
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    l = len(divisors)
    if l % 2 == 0:
        print(divisors[l//2] + divisors[l//2-1] - 2)
    else:
        print(2 * divisors[l//2]- 2)


if __name__ == '__main__':
    main()

Measured memory_bytes: 39152
import java.util.*;
import java.util.stream.Collectors;

public class Main {

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

        int n = scanner.nextInt();

        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = scanner.next();
            if (map.containsKey(s)) {
                int count = map.get(s) + 1;
                map.put(s, count);
            } else {
                map.put(s, 1);
            }
        }

        List<Map.Entry<String, Integer>> entryList = map.entrySet().stream()
                .sorted(java.util.Collections.reverseOrder(java.util.Map.Entry.comparingByValue()))
                .collect(Collectors.toList());

        int max = 0;
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> entry : entryList) {
            int count = entry.getValue();
            if (max <= count) {
                max = count;
                list.add(entry.getKey());
            }
        }
        Collections.sort(list);

        for (String s : list) {
            System.out.println(s);
        }
    }
}

Measured memory_bytes: 85012
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    out.println(solve(sc.nextInt()));

    sc.close();
  }
  private static int solve(int n){
    if(n == 0)return 1;
    if(n == 1)return 2;
    if(n == 2)return 1;
    return 0;
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 26444
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
const int N = 4e5 +11;
int n,m,cnt,d,b[N],ans[N];;
struct uzi{int s,t,x,i;}p[N];
struct faker{int x,i; bool operator <(const faker & t)const{return x<t.x;} }a[N];
int cmp(uzi a,uzi b){return a.x<b.x;}
map<int,int>pos;
bool operator < ( pair<int,int>A,pair<int,int>B ){return A.fir<B.fir;}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>m;
	memset(ans,-1,sizeof ans);
	for(int i=1;i<=n;i++){
		cin>>p[i].s>>p[i].t>>p[i].x;
		p[i].s-=p[i].x;p[i].t-=p[i].x;p[i].i=i;
		p[i].s=max(p[i].s,0);
		p[i].t=max(p[i].t,0);
	}
	sort(p+1,p+1+n,cmp);
	for(int i=1;i<=m;i++)cin>>a[i].x,a[i].i=i,pos[a[i].x]=i;
	set<int>s;
	for(int i=1;i<=m;i++)s.insert(a[i].x);
	for(int i=1;i<=n;i++){
		auto l=s.lower_bound(p[i].s);
		auto k=s.lower_bound(p[i].t);
		vector<int>q;
		for(auto j=l;j!=k;j++){
			ans[pos[*j]]=p[i].x;
			q.pb(*j);
		}
		for(auto j:q)s.erase(j);
	}
	for(int i=1;i<=m;i++)cout<<ans[i]<<'\n';
	return 0;
}

Measured memory_bytes: 32512
#include <vector>
#include <climits>
#include <algorithm>
#include <iostream>
using namespace std;
 
template <typename T> class Segment_Tree {
private:
    int n; // n = ????´???° ???2*n-1 = ????????°
    std::vector<T> SegTree;
 
public:
    Segment_Tree(int n_) {
	n = 1;
	while( n < n_ )  n *= 2;
	SegTree = std::vector<T>(2*n-1, 0);
    }
     
    void update(int k, T a) {
	k += n - 1; // ??????index
	SegTree[k] += a; // k?????????????´???? a ?????????
	while( k > 0 ) { // ????????§?????????????????´??°
	    k = (k-1) / 2;
	    SegTree[k] += a; // ???
	}
    }
 
    T range_query(int a, int b) { // [a,b)????§£
	return query(a,b,0,0,n);
    }
 
    // [a,b)??????????±???????
    // k:?????????index???l,r:??????k????????????????????????[l,r)
    // ?????£?????????????????????????????¨?????? query(a,b,0,0,n) ??¨??????
    T query(int a, int b, int k, int l, int r) {
	if( r <= a or  b <= l ) return 0;    // ?????????????????§??????
	if( a <= l and r <= b ) return SegTree[k]; // [a,b)???[l,r)????????¨???????????????????????´???
 
	T vl = query(a,b,k*2+1,l,(l+r)/2);
	T vr = query(a,b,k*2+2,(l+r)/2,r);
	return vl+vr;
    }
 
    void dump() { // ??¨?????¨???
	cout << "Tree:" << endl;
	for(int i=1; i<2; i*=2) {
	    for(int j=0; j<i; j++ )
		cout << SegTree[i+j-1] << " ";
	    cout << endl;
	}
    }
};
 
 
 
int main() {
 
    int n,q;
    cin >> n >> q;
    Segment_Tree<long long > seg(n);
 
    for( int i=0; i<q; i++ ) {
	long long c,x,y; cin >> c >> x >> y;
	if(c == 0)
	    seg.update(x-1,y);
	else
	    cout << seg.range_query(x-1,y) << endl;
    }
}

Measured memory_bytes: 7084
#include <bits/stdc++.h>
            using namespace std;
             
            int main() {
              int a,b,c,d,n;
              cin >> n;
              a = n/1000;
              b = n%1000/100;
              c = n%100/10;
              d = n%10;
              if ((a==b && b==c) || (b==c && c==d)){
                cout << "Yes" << endl;
              }
              else{
                cout << "No" << endl;
              }
            }

Measured memory_bytes: 256