akhauriyash/Code-Regression huggingface dataset:
alphabet = 'aabcdefghijklmnopqrstuvwxy'
N =int(input())
name = ''
while N > 0:
    n = N % 26
    N = N // 26
    if n == 0:
        name += 'z'
        N = N-1
    else:
        name += alphabet[n]
new_name = name[::-1]
print(new_name)

Measured memory_bytes: 8944
#include <stdio.h>
 
int main(void) {
     
    int n;
    scanf("%d",&n);

    int a[n-1];
     
    int k;
    for(k=0;k<=n-1;k++){
        scanf("%d",&a[k]);
    }
     
    int i;
    for(i=n-1;i>=0;i--){
        if(i!=n-1) printf(" ");
        printf("%d",a[i]);
    }
    putchar('\n');
    return 0;
}


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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000

using namespace std;
typedef long long ll;
typedef pair<ll ,ll> P;
const ll mod = 1e9+7;
const long double EPS = 0.0000000001;

int main(){
    vector<int> items = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << items[--k]<< endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;

int main(){
    ll r;
    ld pi=3.1415926535;
    cin>>r;
    cout<<setprecision(10)<<2*pi*r;
    return 0;
}

Measured memory_bytes: 3788
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#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()
{
  int q;
  cin >> q;
  vector<int> com(q);
  vector<ll> a(q),b(q);
  rep(i,q){
    cin >> com[i];
    if(com[i]==1) cin >> a[i] >> b[i];
  }

  ll asum = 0,bsum = 0;
  multiset<ll> st;
  auto medit = st.end();  
  rep(i,q){
    if(com[i]==1){
      bsum += b[i];
      int ss = st.size();
      if(ss==0){
	st.insert(a[i]);
	medit = st.begin();
      }
      else if(ss%2==0){
	ll med = *medit;
	st.insert(a[i]);	
	if(med<=a[i]){
	  ++medit;
	  asum += a[i] - *medit;
	}
	else{
	  asum += med - a[i];
	}
      }
      else{
	ll med = *medit;
	st.insert(a[i]);	
	if(med<=a[i]){
	  asum += a[i] - med;
	}
	else{
	  asum += med - a[i];
	  --medit;	  
	}
      }
    }
    else{
      cout << *medit << " " << asum+bsum << "\n";
    }
  }

  
  return 0;
}


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

int main(){
  int l=0,r=0;
  int N,M,X;
  cin >> N >> M >> X;
  for(int i=0;i<M;i++){
    int a;
    cin >> a;
    if(a<X) l++;
    else r++;
  }
  cout << min(l,r) << 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;

int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    int ans=0;
    rep(i, n){
        cin >> s[i];
    }
    sort(s.begin(), s.end());
    decltype(s)::iterator result = unique(s.begin(), s.end());
    s.erase(result, s.end());
    cout << s.size() << endl;
}

Measured memory_bytes: 9592
fn main() {
    let n: usize = read::<usize>();
    let k: usize = read::<usize>();
    let mut v: Vec<isize> = vec![];
    for _ in 0..n {
        v.push(read());
    }
    let mut dp = vec![std::isize::MAX; n];
    dp[0] = 0;
    for i in 1..n {
        for j in 1..k + 1 {
            let s = i.saturating_sub(j);
            dp[i] = min(dp[s] + (v[i] - v[s]).abs(), dp[i]);
        }
    }
    println!("{}", dp[n - 1]);
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: isize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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 a,b;
void solve(){
	cin >> a >> b;
	cout << max(a-2*b, 0) << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    A=list(map(int,input().split()))
    A.sort(reverse=1)
    z=-(-sum(A)//(4*M))
    if A[M-1]>=z:
        print('Yes')
    else:
        print('No')
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <stdio.h>

int main(void)
{
  char a,b;
  int acd,tcd;
  
  scanf("%c %c",&a,&b);

  if(a=='H')
    acd=0;
  else
    acd=1;

  if(b=='H')
    tcd=1-acd;
  else
    tcd=acd;

  printf("%c",tcd==1 ? 'H' : 'D');

  return 0;
}
  


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<random>

#include<stack>
#include<queue>
#include<bitset>
#include<sstream>

using namespace std;
//using ll = long long;

int main(int argc, char const *argv[]){
    string s,p="";
    cin >> s;
    int n = s.size(), cnt = 0;
    vector<int> a(n,0);
    int start=0;
    int r=0;
    for(int i=0;i<(n-1);i++){
        if(s[i]=='R'){r++;}
        p += s[i];
        if((s[i]=='L')&&(s[i+1]=='R')){
            a[start+r-1] = int((r+1)/2)+int((p.size()-r)/2);
            a[start+r] = int((r)/2)+int((p.size()-r+1)/2);
            start+=p.size();
            r = 0;
            p = "";
        }
    }
    p += s[n-1];
    a[start+r-1] = int((r+1)/2)+int((p.size()-r)/2);
    a[start+r] = int((r)/2)+int((p.size()-r+1)/2);
    cout << a[0];
    for(int i=1;i<n;i++){
        cout << " " << a[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1152
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
inline void write(int x)
{
    if(x<0)
	{
    	putchar('-');
		x=-x;
	}
    if(x>9)
		write(x/10);
    putchar(x%10+'0');
}
int main()
{
	ios::sync_with_stdio(false);
    int a,b,c,ab,bc;
    a=read();
    b=read();
    c=read();
    ab=a-b;
    bc=b-c;
    if(ab==bc) puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

#define MIN(a,b) ((a) < (b) ? (a) : (b))

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i64 dp[5] = {0};
  for (i32 i = 0; i < n; ++i) {
    i32 a;
    scanf ("%" SCNi32, &a);
    i32 even = a == 0 ? 2 : a % 2;
    i32 odd = a % 2 == 0 ? 1 : 0;
    dp[4] = a + MIN(dp[4], MIN(dp[3], MIN(dp[2], dp[1])));
    dp[3] = even + MIN(dp[3], MIN(dp[2], dp[1]));
    dp[2] = odd + MIN(dp[2], MIN(dp[1], dp[0]));
    dp[1] = even + MIN(dp[1], dp[0]);
    dp[0] = a + dp[0];
  }
  i64 ans = MIN(dp[0], MIN(dp[1], MIN(dp[2], MIN(dp[3], dp[4]))));
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void DDCC2019D()
{
	int M;
	cin >> M;
	vl d(M), c(M);
	for (int i = 0; i < M; ++i)
	{
		cin >> d[i] >> c[i];
	}
	vl x(M);
	vi dd(M);
	ll res = 0;
	for (int i = 0; i < M; ++i)
	{
		ll y = (c[i] - 1) * (9 + d[i]) + d[i];
		res += y / 9;
		dd[i] = y % 9;
		if (dd[i] == 0)
		{
			dd[i] = 9;
			--res;
		}
	}
	for (int i = M - 2; i > -1; --i)
	{
		int x = dd[i] + dd[i + 1];
		++res;
		if (x > 9)
		{
			dd[i] = 1;
			dd[i + 1] = x - 10;
			x = dd[i] + dd[i + 1];
			++res;
		}
		dd[i] = x;
	}
	cout << res << endl;

}


int main()
{
	DDCC2019D();
	return 0;
}


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

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

    bool flag = false;
    rep(i, s.size()) {
        if (s[i] == '7')
            flag = true;
    }

    flag ? cout << "Yes" : cout << "No";
    cout << endl;

    return 0;
}


Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)2e9 + 1;
const ll mod = (ll)1e9 + 7;

int main()
{
	ll l, r;
	cin >> l >> r;

	ull ans = inf;
	for (ll i = l; i <= r; i++)
	{
		for (ll j = i + 1; j <= r; j++)
		{
			ull x = (i * j) % 2019;
			ans = min(ans, x);
			if (x == 0)
			{
				cout << ans << endl;
				return 0;
			}
		}
	}

	cout << ans << endl;
}

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

int main () {
  int N, ans = 0;
  cin >> N;
  vector<int>L(N);
  for (int i = 0; i < N; i++) {
    cin >> L.at(i);
  }
  sort(L.begin(), L.end());
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = j + 1; k < N; k++) {
        if ( L.at(j) < L.at(i) + L.at(k)) {
          if ( L.at(k) < L.at(j) + L.at(i)) {
            ans++;
          }
        }
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x) {
	S[++top] = x;
}

int pop() {
	top--;
	return S[top+1];
}

int main() {
	int a,b;
	top = 0;
	char s[100];
	
	while( scanf("%s", s) != EOF ) {
		if ( s[0] == '+') {
			a = pop();
			b = pop();
			push(a + b);
		} else if ( s[0] == '-' ) {
			b = pop();
			a = pop();
			push(a - b);
		} else if ( s[0] == '*') {
			a = pop();
			b = pop();
			push(a * b);
		} else {
			push(atoi(s));
		}
	}
	
	printf("%d\n", pop());
	
	return 0;
}



Measured memory_bytes: 2080
import numpy as np
import sys
X, N = map(int, input().split())
if N == 0:
    print(X)
    sys.exit()
p = list(map(int, input().split()))

p.sort()

p0 = [0]
j = 0
for i in range(1,100):
    if p[j]!=i:
        p0.append(i)
    elif p[j] == i:
        j+=1
    if j == N:
        for i0 in range(i+1,100):
            p0.append(i0)
        break
p0.append(101)
p1 = [0 for i in range(len(p0))]
for i in range(len(p0)):
    p1[i] = p0[i]-X
    p1[i] = np.abs(p1[i])
    
ii = np.argmin(p1)

print(p0[ii])

Measured memory_bytes: 27148
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;


int main(){
  
  map<int,int> m;
  int n; cin>>n;
  while(n--){
    int a; cin>>a;
    m[a]++;
  }  
  int ans{};
  for(auto i:m){
    if(i.first<i.second)ans += i.second-i.first;
    if(i.first>i.second)ans += i.second;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 8116
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 111;
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (b * c >= a)
        puts("Yes");
    else
        puts("No");
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL -1
#define L 14

char H[M][L];

int getChar(char);

long long getKey(char*);
int h1(int);
int h2(int);
int find(char*);
int insert(char*);

int main(){
  int i,n,h;
  char str[L],com[9];
  for(i=0;i<n;i++)
    H[i][0]='\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%s",com,str);
    if(com[0]=='i'){
      insert(str);
    }
    else{
      if(find(str)){
	  printf("yes\n");
	}
      else{
	printf("no\n");}}}
  return 0;
}
int getChar(char ch){
  if(ch=='A')
    return 1;
  else if(ch=='C')
    return 2;
  else if(ch='G')
    return 3;
  else if(ch=='T')return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
  }
  return sum;
}
int h1(int key)
{
  return key % M;

}
int h2(int key)
{
  return 1+(key%(M-1));
    }

int find(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)
      return 1;
    else if (strlen(H[h])==0)
      return 0;}
  return 0;}

int insert(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)
      return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }}
  return 0;}



Measured memory_bytes: 16976
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    while (1) {
        int T,D,L; cin >> T >> D >> L;
        if (T+D+L==0) break;
        vector<int> X(T);
        rep(i,T) cin >> X[i];

        int cnt = 0, ans = 0;
        rep(i,T) {
            if (X[i] >= L) cnt = D;
            else cnt--;
            if (cnt > 0) ans++;
        }
        if (ans > 0) --ans;
        cout << ans << ln;
    }
}



Measured memory_bytes: 3580
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

vector<int> dy = { 0,0,1,-1 };
vector<int> dx = { 1,-1,0,0 };

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;
}

template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {
	o << "{" << obj.first << ", " << obj.second << "}"; return o;
}

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}

int main() {
	int X, Y; cin >> X >> Y; cout << X + Y / 2 << endl;
	
	return 0;
}



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

using namespace std;

#define inf    0x3f3f3f3f
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef vector<int>      vi;
typedef vector<bool>     vb;
#define INF (int)1e15
#define MOD 1000000007

#define access(i) a[i/3][i%3]
//#define random_shuffle(r...)random_shuffle(r,[](int _){return my_rand()%_;})

 int main(){

   int d,t,s;
  cin>>d>>t>>s;

  double tt = (double)d/s;

//cout<<tt<<"  "<<ceil(tt)<<endl;

  if(tt  <= t)
      cout<<"Yes"<<endl;
  else
      cout<<"No"<<endl;


 return 0;
 }

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  out(n * (n-1) / 2);
  return 0;
}


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

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

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

    int N, W;
    cin>>N>>W;
    vector<pair<ll, ll>> wv(N);
    rep(i, N) cin>>wv[i].first>>wv[i].second;

    vector<vector<ll>> dp(N + 1, vector<ll>(100100, 1001001001001));
    int i, j;
    rep(i, N) {
        dp[i + 1][wv[i].second] = min(dp[i][wv[i].second], wv[i].first);
        rep(j, 100100) {
            if (dp[i][j] == 1001001001001) continue;

            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j]);
            dp[i + 1][j + wv[i].second] = min(dp[i][j + wv[i].second], dp[i][j] + wv[i].first);
        }
    }
    ll m = 1001001001001;
    rep(i, 100100) {
        if (dp[N][i] <= W) m = i;
    }
    cout<<m<<endl;
}

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

int main(void)
{
    int x;
    cin >> x;
    int mod = x;
    int ans = 0;
    ans += (mod / 500) * 1000;
    mod = x % 500;
    ans += (mod / 5) * 5;
    cout << ans << endl;
    return 0;
}


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

int main() {
  int x;
  cin >> x;
  
  if(x<100){
    cout << "0" << endl;
  }
  
  else if(x%100 > 5 && x/100==1){
    cout << "0" << endl;
  }
  
  else if(x%100 > 10 && x/100==2){
    cout << "0" << endl;
  }
  
  else if(x%100 > 15 && x/100==3){
    cout << "0" << endl;
  }
  
  else if(x%100 > 20 && x/100==4){
    cout << "0" << endl;
  }
  
  else if(x%100 > 25 && x/100==5){
    cout << "0" << endl;
  }
  
  else if(x%100 > 30 && x/100==6){
    cout << "0" << endl;
  }
  
  else if(x%100 > 35 && x/100==7){
    cout << "0" << endl;
  }
  
  else if(x%100 > 40 && x/100==8){
    cout << "0" << endl;
  }
  
  else if(x%100 > 45 && x/100==9){
    cout << "0" << endl;
  }
  
  else if(x%100 > 50 && x/100==10){
    cout << "0" << endl;
  }
  
  else if(x%100 > 55 && x/100==11){
    cout << "0" << endl;
  }
  
  else if(x%100 > 60 && x/100==12){
    cout << "0" << endl;
  }
  
  else if(x%100 > 65 && x/100==13){
    cout << "0" << endl;
  }
  
  else if(x%100 > 70 && x/100==14){
    cout << "0" << endl;
  }
  
  else if(x%100 > 75 && x/100==15){
    cout << "0" << endl;
  }
  
  else if(x%100 > 80 && x/100==16){
    cout << "0" << endl;
  }
  
  else if(x%100 > 85 && x/100==17){
    cout << "0" << endl;
  }
  
  else if(x%100 > 90 && x/100==18){
    cout << "0" << endl;
  }
  
  else if(x%100 > 95 && x/100==19){
    cout << "0" << endl;
  }
  
  else{
    cout << "1" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node{int p,l,r;};

Node T[MAX];
int n,D[MAX];

void print(int u){
  int c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if(T[u].p == NIL) cout << "root, ";
  else if(T[u].l == NIL) cout << "leaf, ";
  else cout << "internal node, ";

  cout << "[";

  for(int i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i) cout << ", ";
    cout << c;
  }
  cout << "]" << endl;
}

int rec(int u,int p){
  D[u] = p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main(){
  int l,r;
  cin >> n;
  for(int i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;

  for(int i=0;i<n;i++){
    int v,d;
    cin >> v >> d;
    for(int j=0;j<d;j++){
      int c;
      cin >> c;
      if(j == 0) T[v].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  for(int i=0;i<n;i++){
    if(T[i].p == NIL) r = i;
  }
  rec(r,0);
  for(int i=0;i<n;i++) print(i);
  return 0;
}



Measured memory_bytes: 7748
A, B, C, D = map(int, input().split())

Rect1 = int(A*B)

Rect2 = int(C*D)

if (Rect1 > Rect2):
    print(Rect1)

elif (Rect1 < Rect2):
    print(Rect2)

else:
    print(Rect1)

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

int main() {
  int N,a=0,tmp;
  cin >> N;
  tmp = N;
  while(tmp !=0){
    tmp /= 10;
    a++; 
  }
  int ans=0;

  rep(i,a){
    if( i%2 == 0 && i < a - 1){
      ans += pow(10,i+1) - pow(10,i);
    }
    if( i%2 == 0 && i == a - 1){
      ans += N - pow(10,i) + 1;
    }
  }

  cout << ans << endl;


}


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

int number[6];
int work[6];

class Dice {
public:
    void setLabel(int index, int num) {
        number[index] = num;
    }
    void roll(char dst) {
		for (int i = 0; i < 6; i++) work[i] = number[i];
		if (dst == 'E') setNumber(work[3], work[1], work[0], work[5], work[4], work[2]);
		else if (dst == 'N') setNumber(work[1], work[5], work[2], work[3], work[0], work[4]);
		else if (dst == 'S') setNumber(work[4], work[0], work[2], work[3], work[5], work[1]);
		else if (dst == 'W') setNumber(work[2], work[1], work[5], work[0], work[4], work[3]);
	}
	int returnPeek() {
		return number[0];
	}
	void setNumber(int n0, int n1, int n2, int n3, int n4, int n5) {
		number[0] = n0;
		number[1] = n1;
		number[2] = n2;
		number[3] = n3;
		number[4] = n4;
		number[5] = n5;
	}
};

int main() {
    Dice dice;
    int label;
    string ch;
    for (int i = 0; i < 6; i++) {
        cin >> label;
        dice.setLabel(i, label);
    }
    cin >> ch;
    for (int i = 0; i < ch.size(); i++) dice.roll(ch[i]);
    cout << dice.returnPeek() << endl;
}


Measured memory_bytes: 3204
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn main() {
    input! {
        n: usize,
        abv: [(usize, usize); n]
    };
    if n % 2 == 0 {
        let mut v1 = abv.clone();
        v1.sort();
        let mut v2 = abv.clone();
        v2.sort_by_key(|x| x.1);
        let a = v2[n / 2 - 1].1 - v1[n / 2 - 1].0 + 1;
        let b = v2[n / 2].1 - v1[n / 2].0 + 1;
        let res = b + a - 1;
        println!("{}", res);
    } else {
        let mut v1 = abv.clone();
        v1.sort();
        let mut v2 = abv.clone();
        v2.sort_by_key(|x| x.1);
        let res = v2[n / 2].1 - v1[n / 2].0 + 1;
        println!("{}", res);
    }
    // let mut set = BTreeSet::new();
    // for a in 1..=2 {
    //     for b in 1..=2 {
    //         for c in 2..=5 {
    //             for d in 3..=4 {
    //                 let mut v = vec![a, b, c, d];
    //                 v.sort();
    //                 set.insert((v[1], v[2]));
    //             }
    //         }
    //     }
    // }
    // for (a, b) in set {
    //     println!("{}, {}", a, b);
    // }
}


Measured memory_bytes: 16572
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  ll n, s; cin >> n >> s;
  ll ans = n == s ? n + 1 : LINF, lb = n + 1;
  for (ll ms = 1; ; ++ms) {
    ll b = n / ms, rem = n % ms;
    if (b <= ms) break;
    ll l = (b - rem) / (ms + 1) - ((b - rem) % (ms + 1) == 0);
    assert(l >= 0);
    chmin(lb, b - l);
    if (s >= ms + rem && (s - ms - rem) % ms == 0 && (s - ms - rem) / ms <= l) chmin(ans, b - (s - ms - rem) / ms);
  }
  for (int b = 2; b < lb; ++b) {
    ll sum = 0, tmp = n;
    while (tmp > 0) {
      sum += tmp % b;
      tmp /= b;
    }
    if (sum == s) chmin(ans, b);
  }
  cout << (ans == LINF ? -1 : ans) << '\n';
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5 + 5;
int n;
int a[N];
int q;
ll f[N];

int main (){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    ll sum = 0;
    for(int i = 0; i < n; ++i){
        int x;
        cin >> x;
        f[x]++;
        sum += x;
    }
    cin >> q;
    while(q--){
        int b , c;
        cin >> b >> c;
        sum -= b * f[b];
        sum += f[b] * c;
        f[c] += f[b];
        f[b] = 0;
        cout << sum << endl;
    }

return 0;
}


Measured memory_bytes: 4280
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    if((n < 2) && (a != b)){
        cout << 0 << endl;
        return 0;
    }
    if(b < a){
        cout << 0 << endl;
        return 0;
    }
    cout << (b - a) * (n - 2) + 1 << endl;
        return 0;
}

Measured memory_bytes: 256
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define sec second
#define fir first
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define entire(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
void solve()
{
	int n; cin >> n;
	int arr[n][3];
	rep(i, n)rep(j, 3)cin >> arr[i][j];
	int ans[n][3];
	memset(ans, 0, sizeof(ans));
	rep(j, 3)
	ans[0][j] = arr[0][j];
	repe(i, 1, n) {
		rep(j, 3) {
			ans[i][j] = arr[i][j] + max(ans[i - 1][(j + 1) % 3], ans[i - 1][(j + 2) % 3]);
		}
	}
	// rep(i, n)
	// {
	// 	rep(j, 3)
	// 	cout << ans[i][j] << " ";
	// 	cout<<endl;
	// }

	cout << max(max(ans[n - 1][0], ans[n - 1][1]), ans[n - 1][2]) << endl;
}


int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast
	int T = 1;
	// cin >> T;
	while (T--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 5920
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

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

void solve_A(){
    int n,r;
    cin >> n >> r;
    if(n >= 10) cout << r;
    else cout << r + 100 * (10-n);
}

void solve_B(){
    int n, k, ctr = 0;
    cin >> n >> k;

    while(n > 0){
        n /= k;
        ctr++;
    }
    cout << ctr;
}

void solve_C(){
    int n;
    cin >> n;

    int x[n];
    REP(i,n) cin >> x[i];

    int minimum = 100000000;
    REP(P,100){
        int tmp = 0;
        REP(i,n){
            tmp += (x[i] - P) * (x[i] - P);
        }
        if(minimum >= tmp) minimum = tmp;
    }

    cout << minimum;
}

int main(void){
    solve_C();
    
    return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int s, int d, Weight w)
    : src(s), dst(d), weight(w) {
  }
};

using Edges  = vector<Edge>;
using Graph  = vector<Edges>;
using Array  = vector<Weight>;
using Matrix = vector<Array>;

void addEdge(Graph &g, int a, int b, Weight w = 1) {
  g[a].emplace_back(a, b, w);
  g[b].emplace_back(b, a, w);
}

void addArc(Graph &g, int a, int b, Weight w = 1) {
  g[a].emplace_back(a, b, w);
}

class UFT {
private:
  vi data, rnk;

public:
  UFT(const int &size)
    : data(size), rnk(size) {
    iota(all(data), 0);
  }

  int root(const int &x) {
    return data[x] == x ? x : data[x] = root(data[x]);
  }

  bool same(const int &a, const int &b) {
    return root(a) == root(b);
  }

  void unite(int a, int b) {
    a = root(a), b = root(b);
    if (a == b) return;
    if (rnk[a] < rnk[b]) swap(a, b);
    data[b] = a;
    if (rnk[a] == rnk[b]) rnk[a]++;
  }
};

pair<Weight, Edges> kruskal(const Graph &g) {
  UFT uf(g.size());
  Edges es;
  for (auto &adj : g) {
    for (auto &e : adj) es.emplace_back(e);
  }
  sort(all(es), [](const Edge &e, const Edge &f) { return e.weight < f.weight; });
  Weight total = 0;
  Edges T;
  for (auto &e : es) {
    if (!uf.same(e.src, e.dst)) {
      T.pb(e);
      total += e.weight;
      uf.unite(e.src, e.dst);
    }
  }
  return mp(total, T);
}

void solve() {
  int n;
  cin >> n;
  vpii v(n), xs(n), ys(n);
  rep(i, n) {
    cin >> v[i].fi >> v[i].se;
    xs[i] = mp(v[i].fi, i);
    ys[i] = mp(v[i].se, i);
  }
  sort(all(xs)), sort(all(ys));
  Graph g(n);
  loop(i, 1, n) {
    addEdge(g, xs[i - 1].se, xs[i].se, abs(v[xs[i - 1].se].fi - v[xs[i].se].fi));
    addEdge(g, ys[i - 1].se, ys[i].se, abs(v[ys[i - 1].se].se - v[ys[i].se].se));
  }
  cout << kruskal(g).fi << endl;
}


Measured memory_bytes: 37864
n,k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
ary = [0]
n.times do |i|
  ary[i+1]= a[i] + ary[i]
end
beauty = []
n.times do |i|
  (n-i).times do |j|
    beauty << ary[i+j+1]-ary[i]
  end
end
beauty.sort!
max = beauty[-1]
digit = 0
while max > 0
  digit += 1
  max /= 2
end
digit.times do |i|
  check = 2 ** (digit-i-1)
  cnt = 0
  newBeauty = []
  beauty.each do |v|
    if v & check > 0
      cnt += 1
      newBeauty << v
    end
  end
  if cnt >= k
    beauty = newBeauty
  end
end
beauty.reverse!
ans = beauty[0]
(k-1).times do |i|
  ans &= beauty[i+1]
end
p ans

Measured memory_bytes: 14184
n,a,b= map(int,input().split())
if a<b:
  tmp=a
  a=b
  b=tmp
if abs(a-b)%2==0:
  c=abs(a-b)//2

else:

  if abs(a-b)>=3:
    c=min(abs(1-a),abs(n-b))
    c = c-(abs(a-b)//2)
  else:
    c=min(abs(1-a),abs(n-b))


print(c)
  

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

using namespace std;

int main() {
    int N, L;
    string s[N];
    scanf("%d %d", &N, &L);
    for (int i = 0; i < N; i++) {
        cin >> s[i];
    }
    sort(s, s + N);
    for (int i = 0; i < N; i++) {
        cout << s[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
    int n; cin >> n;
    vector<int> d(n); for (int i = 0; i < n; ++ i) cin >> d[i];
    sort(d.begin(), d.end());
    long long ret = 1;
    for (int i = 1; i < n; i++) {
        if (d[i] > d[i - 1]) {
            ret++;
        }
    }
    cout << ret << endl;
}


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

int main(){
  int n;
  cin>>n;
  int a[n];
  rep(i,0,n) cin>>a[i];
  sort(a,a+n);
  int sum=0;
  rep(i,0,n) sum+=a[i];
  if(sum%10!=0) cout<<sum<<endl;
  else{
    int i=0;
    while(i<n && a[i]%10==0){
      i++;
    }
    if(i==n) cout<<0<<endl;
    else cout<<sum-a[i]<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
const long long mod = 1000000007;
long long qpow(long long base, long long pnt){
	long long ans = 1LL;
	while(pnt){
		if(pnt & 1) ans = (ans * base) % mod;
		base = (base*base) % mod;
		pnt >>= 1;
	}
	return ans;
}
long long inv(long long now){
	return qpow(now, mod-2);
}
long long f[100100];
long long inv_f[100100];
long long Cm[100100];
long long preCm[100100];
long long sufCm[100100];
int n, m;
long long a[100100];

int main(){
	scanf("%d%d", &n, &m);
	rep(i, n) scanf("%lld", &a[i]);
	sort(a, a+n);
	m -= 2;
	f[0] = 1;
	for(int i = 1; i <= n; i++) f[i] = (f[i-1] * i) % mod;
	rep(i, n+1) inv_f[i] = inv(f[i]);
	for(int i = m; i <= n; i++){
		int in = (inv_f[m] * inv_f[i-m]) % mod;
		Cm[i] = (f[i] * in) % mod;
	}
	preCm[m] = Cm[m];
	for(int i = m+1; i <= n; i++) preCm[i] = (preCm[i-1] + Cm[i]) % mod;
	sufCm[n] = Cm[n];
	for(int i = n-1; i >= m; i--) sufCm[i] = (sufCm[i+1] + Cm[i]) % mod;
	long long ans = 0;
	for(int i = 0; i <= n-m; i++){
		ans = (ans - a[i] * preCm[n-i-2]) % mod;
		ans = (ans + mod) % mod;
	}
	for(int i = m+1; i < n; i++){
		ans = (ans + a[i] * preCm[i-1]) % mod;
		ans = (ans + mod) % mod;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
int main() {
  int d;
  cin >> d;
  if (d == 25) cout << "Christmas" << endl;
  if (d == 24) cout << "Christmas Eve" << endl;
  if (d == 23) cout << "Christmas Eve Eve" << endl;
  if (d == 22) cout << "Christmas Eve Eve Eve" << endl;
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
n=int(input())
use=[0 for i in range(n+1)]
for i in range(1,n+1):
    for j in range(2,n+1):
        while i%j==0 and i!=1:
            i=i//j
            use[j]+=1
ans=1
for i in range(len(use)):
    if use[i]!=0:
        ans*=use[i]+1
print(ans%1000000007)

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

int Answer;

bool isSorted(vector<int> &A) {
    for(int i = 0; i < A.size() - 1; ++i) {
        if(A[i] > A[i + 1]) return false;
    }
    return true;
}

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; ++i) cin >> A[i];
    if(isSorted(A)) cout << "YES\n";
    else {
        for(int i = 0; i < N; ++i) {
            for(int j = i + 1; j < N; ++j) {
                swap(A[i], A[j]);
                if(isSorted(A)) {
                    cout << "YES\n";
                    return 0;
                }
                swap(A[i], A[j]);
            }
        }
        cout << "NO\n";
    }
}

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

int main() {
  std::string str;
  std::cin >> str;
  int str_begin, str_end;
  for (int i=0; i<str.size(); i++) {
    if (str.at(i) == 'A') {
      str_begin = i;
      break;
    }
  }
  for (int i = str.size()-1; i > 0; i--) {
    if (str.at(i) == 'Z') {
      str_end = i;
      break;
    }
  }
  std::cout << str_end - str_begin + 1 << std::endl;
}

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

int main(){
    int a,b,c;
    cin>>a>>b;
    if(b<a) swap(a,b);
    if(a==1&&b==2) cout<<"3"<<endl;
    else if(a==1 && b==3) cout<<"2"<<endl;
    else if(a==2 && b==3) cout<<"1"<<endl;
    return 0;
}

Measured memory_bytes: 256
# 構造化プログラミング

# goto 文は、C/C++言語などで使うことのできる文で、実行されると無条件に指定されたラベルに処理が飛びます。
# 例えば goto CHECK_NUM; という文が実行されると、プログラムの中で CHECK_NUM: と書かれた行に処理が移ります。
# この機能を使って、繰り返し処理なども実現することができます。

# 一方、goto 文は自由度が高すぎ、プログラムの可読性に影響するため、可能な限り使わないことが推奨されています。

# 次のC++言語のプログラムと同じ動作をするプログラムを作成してください。
# ただし、goto 文は使わないで実装してみましょう。 

# (意訳) 標準入力によって数字Nが入力されたとき、
# 1からNまでの数字のうち、3の倍数または3を含む数全てを出力しなさい。
# outputの初めに空白を入れることに注意。

# Input 32
# Output  3 6 9 12 13 15 18 21 23 24 27 30 31 32

# 標準入力
N = gets.chomp.to_i

# 解答を入れる配列
ans_arr = Array.new

# 数字の中に3があるかどうかを判別
def exist3(int)
	int_len = int.to_s.length
	flag = false

	for k in 0..int_len - 1
	key = int_len - 1 - k

		if int / (10 ** key) == 3 
			flag = true
			break
		else int -= (int / (10 ** key)) * (10 ** key)	#前半の()で一番大きな位の桁が得られる

		end
	end
return flag
end	

# カウント
for i in 1..N
	if exist3(i)
		ans_arr += [i]
	elsif i % 3 == 0
		ans_arr += [i]
	elsif i % 10 == 3
		ans_arr += [i]
	end
end
print("\s", ans_arr.join("\s"), "\n")

Measured memory_bytes: 14036
a, b = map(int, input().split())
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

f = factorization(gcd(a,b))
if f[0] != [1, 1]:
    f.append([1,1])
print(len(f))


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

int main() {
    long int A, B, C, K;
    cin >> A >> B >> C >> K;
    
    long int sum = 0LL;

 
    if (K <= (A + B)) {
        if(K > A){
            sum = A;
        }
        if (K <= A) {
            sum = K;
        }
    }
    else if(K > (A + B) ){
        K = K - A - B;
        sum = A - K;
    }


    cout << sum;
}

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

using namespace std;

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

  int N; cin>>N;
  string S; cin>>S;
  char p = S.front();
  int ans = 1;
  for (auto c : S) {
    if (c != p)
      ans++;
    p = c;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>

#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

/*---------------------------------------------------*/

int n,m,a;

void solve(){
  int h,p,q;
  int num[1005];
  queue<pi> qp[1005];
  rep(i,1005)num[i]=i;
   rep(i,m){
    cin>>h>>p>>q;
    qp[h].push(make_pair(p,q));
  }
   
  rrep(i,1004){
    while(qp[i].size()){
      pi tmp;
      tmp=qp[i].front();qp[i].pop();
      swap(num[tmp.first],num[tmp.second]);
    }
  }
  rep(i,1005)if(num[i]==a){cout<<i<<endl;break;}
}

int main(){
  while(1){
    cin>>n>>m>>a;
    if(n==0&&m==0&&a==0)break;
    solve();
  }
  return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define MAX 100004
int a[MAX][4],b[MAX][4];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) for(int j=1;j<=3;j++) cin>>a[i][j];
    for(int i=1;i<=3;i++) b[1][i] = a[1][i];
    for(int i=2;i<=n;i++) {
        for(int k=1;k<=3;k++) {
            b[i][k] = -1;
            for(int j=1;j<=3;j++) {
                if(j!=k) {
                    b[i][k] = max(a[i][k]+b[i-1][j],b[i][k]);
                }
            }
        }
    }
    int ans=-1;
    for(int i=1;i<=3;i++) ans = max(ans,b[n][i]);
    cout<<ans;
}

Measured memory_bytes: 3328
k,n=map(int,input().split())
a=list(map(int,input().split()))
b=[k for _ in range(n)]
for i in range(n-1):
  b[i]=a[i+1]-a[i]
b[n-1]=a[0]+k-a[n-1]
l=max(b)








print(k-l)


Measured memory_bytes: 25840
#include <stdio.h>
#include <limits.h>

#define MAX 500000

long cnt = 0;
long L[MAX / 2 + 1], R[MAX / 2 + 1];
//分割
void merge(long A[], long left, long mid, long right) {
  long i, j, k;
  long n1 = mid - left;
  long n2 = right - mid;
  for (i = 0; i < n1; i++) {
    L[i] = A[left + i];
  }
  L[n1] = LONG_MAX;
  for (i = 0; i < n2; i++) {
    R[i] = A[mid + i];
  }
  R[n2] = LONG_MAX;

  i = 0;  j = 0;

  for (k = left; k < right; k++) {
    if (L[i] <= R[j]) {
      A[k] = L[i];
      i++;
      cnt++;
    } else {
      A[k] = R[j];
      j++;
      cnt++;
    }
  }
}

//統合
void mergeSort(long A[], long left, long right) {
  int mid;
  if (left + 1 < right) {
    mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(void) {
  long A[MAX];
  long i, n;

  scanf("%ld", &n);

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

  mergeSort(A, 0, n);

  printf("%ld", A[0]);
  for(i = 1; i < n; i++)
    printf(" %ld", A[i]);
  printf("\n%ld\n", cnt);

  return 0;
}

Measured memory_bytes: 8840
#include<bits/stdc++.h>
#define EPS (1e-7)
#define N 50
using namespace std;
int n,x[N],y[N],flag=1;
double gx,gy;

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i];
    gx+=x[i]; gy+=y[i];
  }
  gx/=n; gy/=n;
  for(int i=0;i<n;i++){
    double px=gx+(gx-x[i]),py=gy+(gy-y[i]);
    int f=0;
    for(int j=0;j<n;j++)
      if(abs(px-x[j])<EPS&&abs(py-y[j])<EPS)f=1;
    if(!f)flag=0;
  }
  if(flag)printf("%.8f %.8f\n",gx,gy);
  else cout<<"NA"<<endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  //何も買えない
  if (N < 4) {
    cout << "No" << endl;
    return 0;
  }

  //どっちかだけで買える
  if (N % 4 == 0 || N % 7 == 0) {
    cout << "Yes" << endl;
    return 0;
  }

  //組み合わせで買うしかない
  int dm = N / 4, km = N / 4;

  for (int i = 1; i <= dm; i++) {
    for (int j = 1; j <= km; j++)
      if (N == i * 4 + j * 7) {
        cout << "Yes" << endl;
        return 0;
      }
  }

  cout << "No" << endl;
}

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

using namespace std;

int main() {
	string s;
	int k;
	cin >> k >> s;

	if(s.size() <= k) {
		cout << s << '\n';
	} else {
		for(int i = 0; i < k; ++i) {
			cout << s[i];
		}
		cout << "..." << '\n';
	}

	return 0;
}


Measured memory_bytes: 3628