akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

std::vector<ll> divisors( ll x )
{
  std::vector<ll> ret;

  for( ll i = 1; i*i <= x; ++i ) if( x % i == 0 )
  {
    ret.emplace_back( i );

    if( i != x/i )
      ret.emplace_back( x/i );
  }

  return ret;
}

ll N;
ll ans;

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

  repi( A, 1, N+1 ) {
    ans += (N-1)/A;
  }

  std::cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> vec(1000001, 0);
    for (int i = 1; i <= 1000000; i++){
        for (int j = 1; j * i <= 1000000; j++){
            vec[i * j]++;
        }
    }
    int ans = 0;
    for (int c = 1; c <= N - 1; c++){
        ans += vec[c];
    }
    cout << ans << endl;
}

Measured memory_bytes: 7220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD =   1000000007;


struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};


int main()
{
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int N, M; cin >> N >> M;
    vector<int> X(M), Y(M), Z(M);
    for (int i = 0; i < M; ++i){
        cin >> X[i] >> Y[i] >> Z[i];
        --X[i], --Y[i];
    }

    UnionFind uf(N);
    for (int i = 0; i < M; ++i){
        uf.merge(X[i], Y[i]);
    }

    set<int> se;
    for (int i = 0; i < N; ++i){
        se.insert(uf.root(i));
    }
    
    cout << se.size() << endl;
    return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

bool isPal(int i, int j, string &s)
{
    while (i < j)
    {
        if (s[i] != s[j])
        {
            return false;
        }
        i++;
        j--;
    }
    return true;
}
int main()
{
    double d;
    cin >> d;
    d /= 3;
    cout << std::fixed << std::setprecision(10) << d * d * d << endl;
    return 0;
}

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

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}

typedef pair<int, int> P;
int main(){
	int N;
	cin >> N;

	int ans = 0;
	for(int i=1; i<=N; i+=2){//奇数のみでよいので i+=2
		//iについて素因数分解する
		vector<P> vec; //vec[i].first: 素因数pの値, second: pの個数
		int tmp = i;
		for(int j=2; j*j<i; j++){
			int cnt = 0;
			while(true){
				if(tmp % j != 0) break;
				tmp /= j;
				cnt++;
			}
			vec.emplace_back(j, cnt);
		} 

		int num = 1;//iの約数の個数 (= 素因数分解のそれぞれの素数の方の値+1の積)
		for(int j=0; j<vec.size(); j++){
			num *= vec.at(j).second + 1 ;
		}
		if(num == 8) ans++;
		// if(num == 8){
		// 	cout << i << ":  ";
		// 	for(int j=0; j<vec.size(); j++){
		// 		for(int k=0; k<vec.at(j).second; k++){
		// 			cout << vec.at(j).first << "  ";
		// 		}
		// 	}cout << endl;
		// }
	}

	cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
ll n,a[N],ans=(1e18);
pair<ll,ll> l[N],r[N];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(ll i=0;i<n;i++)cin>>a[i];
    for(ll i=0,sl=0,sr=0,cur=0;i<n;i++){
        sr+=a[i];
        while(cur<=i && abs(sl-sr)>=abs(sl+a[cur]-(sr-a[cur])))
            sl+=a[cur],sr-=a[cur],cur++;
        l[i]=make_pair(sl,sr);
    }
    for(ll i=n-1,sl=0,sr=0,cur=n-1;i>=0;i--){
        sl+=a[i];
        while(cur>=i && abs(sl-sr)>=abs(sl-a[cur] - (sr+a[cur])))
            sl-=a[cur],sr+=a[cur],cur--;
        r[i]=make_pair(sl,sr);
    }
    for(ll i=1;i<n-2;i++){
        ll mx = max({l[i].first,l[i].second,r[i+1].first,r[i+1].second});
        ll mn = min({l[i].first,l[i].second,r[i+1].first,r[i+1].second});
        ans = min(ans , mx-mn);
    }
    cout<<ans;
}


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

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

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>

using namespace std;

int main() {

  int a, c;char b;
  cin >> a >> b >> c;
  double ans, ra, rb;
  string dolphinManJotaro;
  cout << (a + c) * (b == '+') + (a - c) * (b == '-');
  return 0;
}


Measured memory_bytes: 3576
#include<cstdio>
long long n,k;
struct node{
	long long num,all,right;
}a[2005];
int main(){
	long long M=1e9+7;
	scanf("%lld%lld",&n,&k);
	for (int i=1;i<=n;i++)
		scanf("%lld",&a[i].num);
	for (int i=1;i<=n;i++){
		for (int j=1;j<i;j++) if (a[i].num>a[j].num) a[i].all++;
		for (int j=i+1;j<=n;j++) if (a[i].num>a[j].num) a[i].right++;
		a[i].all+=a[i].right;
	}
	long long ans=0;
	for (int i=1;i<=n;i++){
		ans=(ans+k*a[i].right)%M;
		long long t=(k-1)*k;
		t>>=1;
		t%=M;
		t*=a[i].all;
		t%=M;
		ans=(ans+t)%M;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_A = TEN(6);
int n;
int cnt[MAX_A + 1];
bool bad[MAX_A + 1];

int main() {
    fastio();

    cin >> n;
    forn(i, n) {
        int a;
        cin >> a;
        cnt[a]++;
    }

    int ans = 0;
    for (int i = 1; i <= MAX_A; i++) {
        if (bad[i]) continue;
        if (cnt[i] == 1) {
            ans += cnt[i];
        }

        if (cnt[i] > 0) {
            for (ll j = 2LL * i; j <= MAX_A; j += i) {
                bad[j] = true;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8488
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
    int w,n;
    int np[31];
    scanf("%d",&w);
    scanf("%d",&n);
    int cbef,caft;
    for(int i=0;i<31;i++)
        np[i]=i;
    for(int i=0;i<n;i++){
        int sw;
        char gc;
        scanf("%d%c%d",&cbef,&gc,&caft);
        sw=np[cbef],np[cbef]=np[caft],np[caft]=sw;
    }
    for(int i=1;i<w+1;i++)
        printf("%d\n",np[i]);
    return 0;
}

Measured memory_bytes: 1188
#include<cstdio>
#include<algorithm>
#include<vector>
using std::vector;
#define ff(x) for(int x=0;x<2;x++)
using std::swap;
const int N=200011;
typedef long long lint;
lint min(lint a,lint b){return a<b?a:b;}
lint max(lint a,lint b){return a>b?a:b;}
int n;

int fa[N];

int son[N][2];
lint el[N][2];
lint esp[N];

struct Patchouli
{
	lint a,b;
	Patchouli(){}
	Patchouli(lint x,lint y){a=x;b=y;}
	bool friend operator < (Patchouli x,Patchouli y){return (x.a<y.a)||(x.a==y.a&&x.b<y.b);}
};

Patchouli p1[N],p2[N],p[N];
vector<Patchouli> ve[N];
int cnt[N];

#define pat Patchouli
lint k;
void fuck(int x)
{
	if(!son[x][0]) return;
	ff(i)
	{
		esp[son[x][i]]=esp[x]+el[x][i];
		fuck(son[x][i]);
	}
}

void dfs(int x)
{
	if(!son[x][0])
	{
		ve[x].push_back(pat(esp[x],esp[x]));
		cnt[x]=1;
		return;
	}
	int lson=son[x][0],rson=son[x][1];
	dfs(lson),dfs(rson);
	if(cnt[lson]>cnt[rson]) swap(lson,rson);
	int ar1=0,ar2=0,ar=0;
	for(int i=0,aa=-1;i<cnt[lson];i++)
	{
		while(aa<cnt[rson]-1&&ve[rson][aa+1].a+ve[lson][i].b-2ll*esp[x]<=k) aa++;
		if(aa>=0)
		{
			p1[++ar1]=pat(ve[lson][i].a,ve[rson][aa].b);
			p2[++ar2]=pat(ve[rson][aa].b,ve[lson][i].a);
		}
	}
	int a1=1,a2=ar2;
	while(a1<=ar1&&a2)
	{
		if(p1[a1].a<p2[a2].a) p[++ar]=p1[a1++];
		else p[++ar]=p2[a2--];
	}
	while(a1<=ar1)
	{
		p[++ar]=p1[a1++];
	}
	while(a2)
	{
		p[++ar]=p2[a2--];
	}
	for(int i=1;i<=ar;i++)
	{
		if(i==1||p[i].b<p[i-1].b) ve[x].push_back(p[i]),cnt[x]++;
	}
}

bool check(lint lim)
{
	k=lim;
	for(int i=1;i<=n;i++) ve[i].clear(),cnt[i]=0;
	dfs(1);
	return ve[1].size()?1:0;
}


lint r=0x3f3f3f3f3f3f3f3f,l,mid;

int main()
{
//	freopen("travel.in","r",stdin);
//	freopen("travel.out","w",stdout);
	scanf("%d",&n);
	lint vin;
	for(int i=2;i<=n;i++)
	{
		scanf("%d%lld",&fa[i],&vin);
		if(!son[fa[i]][0]) son[fa[i]][0]=i,el[fa[i]][0]=vin;
		else son[fa[i]][1]=i,el[fa[i]][1]=vin;
	}
	fuck(1);
	while(l<r)
	{
		mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%lld\n",l);
	return 0;
}


Measured memory_bytes: 41460
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include<math.h>
int main(){
    int num=3, cont=0;
    char vet[num];
    char frase[num];
    scanf("%s", frase);
    if(frase[0]=='R' && frase[1]=='S' & frase[2]=='R')
        cont=1;

    else{for(int i=0; i<num; ++i){ 
        if(frase[i]=='R'){ 
            cont++;
    }
    }}
    printf("%d\n", cont);

    
    return 0;
}

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


int main(){   
    int k , n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    a.push_back(a[0]+k);
    int l = 0;
    rep(i,n){
        l = max(l, a[i+1]-a[i]);
    }
    int ans = k-l;
    cout << ans << endl;
}


Measured memory_bytes: 4852
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  i32 n;
  cin >> n;
  vi32 a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  reverse(all(a));
  reverse(all(b));
  i32 ans = 0;
  rep(i, n) {
    ans += (ans + a[i] + b[i] - 1) / b[i] * b[i] - (ans + a[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
import math
a,b,c,d = map(int, input().split())
print( (b - (b // c + b // d - (b // ( (c * d) // math.gcd(c , d) )  ) ) )
     - (a - 1 - ((a-1) // c + (a-1) // d - ((a-1) // ( (c * d) // math.gcd(c , d) )  ) ) ) )


Measured memory_bytes: 61916
#include<stdio.h>

int main(){

int x,y,tmp;

while(1){
scanf("%d %d",&x,&y);
if(x>y){
tmp=x;
x=y;
y=tmp;
}
if(x==0&&y==0) break;

printf("%d %d\n",x,y);

}


return 0;

}


Measured memory_bytes: 2724
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int negative_count = 0;
		for(int i = a; i <= b; i++) {
			if(i==0) {
				System.out.println("Zero");
				return;
			}
			if(i < 0) {
				negative_count++;
			}
		}
		if(negative_count%2 == 0) {
			System.out.println("Positive");
		}
		else {
			System.out.println("Negative");
		}
	}
}


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

int main(){
  long long D, G;
  cin >> D >> G;
  G /= 100;
  vector<int> P(D), C(D);
  int N = 0;
  for(int i = 0; i < D; ++i){
    cin >> P[i] >> C[i];
    C[i] /= 100;
    N += P[i];
  }
  vector<int> DP(N+1, 0);
  for(int i = 0; i < D; ++i){
    vector<int> DP_(N+1,0);
    for(int j = 0; j <= N; ++j){
      for(int k = 0; k < P[i]; ++k){
        if(j+k > N) break;
        DP_[j+k] = max(DP_[j+k], DP[j] + (i+1)*k);
      }
      if(j+P[i] <= N)
        DP_[j+P[i]] = max(DP_[j+P[i]], DP[j] + (i+1)*P[i] + C[i]);
    }
    DP = DP_;
  }
  for(int i = 0; i <= N; ++i){
    if(DP[i] >= G){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}

   


  int main(){
      lint N,Q;
      string s,t;
      cin>>s>>t;

      cout<<t<<s;
  }

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

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::fmt;
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};


fn solve(n: usize, k: usize) -> usize {
    let mut r = 1;
    for _ in 0..n {
        r = cmp::min(2 * r, r + k);
    }
    r
}


fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!("{}", solve(sc.next(), sc.next()));
}


struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(1024),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        let buf = &mut self.buf;
        buf.clear();
        self.bytes
            .by_ref()
            .map(Result::unwrap)
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
            .foreach(|c| buf.push(c));
        str::from_utf8(&buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
        <T3 as FromStr>::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }
}


trait Foreach {
    type Item;
    fn foreach<F: FnMut(Self::Item)>(self, f: F);
}

impl<T, I: Iterator<Item = T>> Foreach for I {
    type Item = T;

    fn foreach<F: FnMut(T)>(self, mut f: F) {
        self.fold((), move |(), x| f(x));
    }
}


#[allow(dead_code)]
fn print_yesno(x: bool, yes: &'static str, no: &'static str) {
    println!("{}", if x { yes } else { no });
}


#[allow(dead_code)]
fn print_foreach<T: fmt::Display, I: IntoIterator<Item = T>>(xs: I) {
    let stdout = io::stdout();
    let mut stdout = BufWriter::new(stdout.lock());
    for x in xs.into_iter() {
        writeln!(stdout, "{}", x).unwrap();
    }
    stdout.flush().unwrap();
}


#[allow(dead_code)]
fn print_or<T: fmt::Display>(x: Option<T>, or: &'static str) {
    if let Some(x) = x {
        println!("{}", x);
    } else {
        println!("{}", or);
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
int func(int n);
int main(void){

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

    for(int i=1;i<=N;i++){ 
        printf("%d\n",func(i));
    }

    return 0;
}
int func(int n){
    int count=0;
    for(int i=1;i*i+2*i<=n;i++){
        for(int j=1;j*j+2*j<=n&&j<=i;j++){
            for(int k=1; k*k+2*k<=n&&k<=j;k++){
                if(i*i+j*j+k*k+i*j+j*k+k*i==n){
                    if(i==j&&i==k){count++;}
                    else if(i!=j&&j!=k&&k!=i){count+=6;}
                    else{count+=3;}
                }
            }
        }
    }
    return count;
}

Measured memory_bytes: 1648
#include <iostream>
#include <string>
using namespace std;
#define debug cout<<"OK"<<endl;
#define int long long
const int MAXN=500005;
int n;
string s;
bool a[MAXN];
int mn=0;
int ans=0;

signed main()

{
	ios::sync_with_stdio(false);
	cin>>s;
	int n=s.size();
	for (int i=0;i<n;i++)
		a[i+1]=s[i]=='<';

	for (int i=1;i<=n;i++){
		int cnt=0,j=i;
		if (!a[i]){
			while (!a[j]&&j<=n){
				cnt++;
				j++;
			}
			j--;

			ans+=(cnt-1)*cnt/2;
			if (mn<cnt) ans+=cnt-mn;
			mn=0;
			i=j;
		}
		else{
			while (a[j]&&j<=n){
				mn++;
				j++;
				ans+=mn;
			}
			j--;
			i=j;
		}
	}

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

Measured memory_bytes: 1308
#include<iostream>
#define ll long int
const int ARR = 2e5+5;
using namespace std;
int main(){
    ll n;
    cin >> n;
    ll a[ARR];
    a[0] = 1;
    for(int i = 1 ; i < n ; i++){
        cin >> a[i];
    }
    ll ans[ARR] = {0};
    for(int i = 1 ; i < n ; i++){
        ans[a[i]-1]++;
    }
    for(int i = 0 ; i < n ; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    int64 ans = 0;
    FOR(i,1,n+1){
        if(i % 3 != 0 && i % 5 != 0)ans += i;
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 3664
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]

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

ans = 0
for i in range(n):
    if m >= a[i][1]:
        m -= a[i][1]
        ans += a[i][0] * a[i][1]
    else:
        ans += m * a[i][0]
        break
print(ans)


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

using namespace std;

#define ld long double

const int N 	= 3e3 + 5;

int n;
ld prob[N];
ld dp[N][N];

ld go(int idx, int heads) {
	if (idx > n) {
		int tails = n - heads;
		if (heads > tails) return 1;
		return 0;
	}
	if (dp[idx][heads] >= 0) return dp[idx][heads];
	ld ans = go(idx + 1, heads + 1) * prob[idx] + go(idx + 1, heads) * (1.0 - prob[idx]);
	return dp[idx][heads] = ans;
}

void solve() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> prob[i];
	}
	memset(dp, -1, sizeof(dp));
	ld ans = go(1, 0);
	cout << fixed << setprecision(10);
	cout << ans;
} 

int main() {
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 141568
N, M, X = map(int, input().split())
n = [int(x) for x in input().split()]
num1 = 0
for i in n:
    if i < X:
        num1 += 1
num2 = M - num1
smaller = lambda y, z: z if z < y else y
smaller_num = smaller(num1, num2)
print(smaller_num)


Measured memory_bytes: 2940
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = 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")
}

fn min<T: std::cmp::PartialOrd>(a: T, b: T) -> T {
    if a < b {
        return a;
    } else {
        return b;
    }
}

fn main() {
    let n: usize = read();
    let w: u64 = read();
    let v_max: usize = 100100;

    let mut wi: Vec<u64> = Vec::new();
    let mut vi: Vec<usize> = Vec::new();

    for _ in 0..n {
        wi.push(read());
        vi.push(read());
    }

    let mut dp = vec![vec![std::u64::MAX; v_max+1]; n+1];
    dp[0][0] = 0;

    // i までのアイテムで考えて、価値 sum_v 以上の時の重さの合計 dp[i][sum_v] を最小化
    for i in 0..n {
        for sum_v in 0..v_max+1 {
            if sum_v >= vi[i] {
                if dp[i][sum_v - vi[i]] == std::u64::MAX {
                    dp[i+1][sum_v] = min(dp[i+1][sum_v], std::u64::MAX);
                } else {
                    dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v - vi[i]] + wi[i]);
                }
            }
            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v]);
            // println!("{} {} {}", i+1, sum_v, dp[i+1][sum_v]);
        }
    }

    let mut ans: usize = 0;
    for sum_v in 0..v_max+1 {
        if dp[n][sum_v] <= w {
            ans = sum_v;
        }
    }
    
    println!("{}", ans);
}


Measured memory_bytes: 106748
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
from collections import deque

input = sys.stdin.readline

def main():
    H, W = [int(e) for e in input().split()]
    S = [0 for _ in range(H)]
    for i in range(H):
        S[i] = list(input())[:W]

    w = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                w += 1

    dp = [[0 for _ in range(W)] for _ in range(H)]
    enc = [[False for _ in range(W)] for _ in range(H)]

    i = 0
    j = 1

    q = deque([[0, 0]])
    enc[0][0] = True
    dp[0][0] = 1
    while len(q) != 0:
        pos = q.popleft()

        x = pos[0]
        y = pos[1]

        if x+1 != H and S[x+1][y] == "." and not enc[x+1][y]:
            dp[x+1][y] = dp[x][y] + 1
            enc[x+1][y] = True
            q.append([x+1, y])
        if y+1 != W and S[x][y+1] == "." and not enc[x][y+1]:
            dp[x][y+1] = dp[x][y] + 1
            enc[x][y+1] = True
            q.append([x, y+1])
        if x-1 != -1 and S[x-1][y] == "." and not enc[x-1][y]:
            dp[x-1][y] = dp[x][y] + 1
            enc[x-1][y] = True
            q.append([x-1, y])
        if y-1 != -1 and S[x][y-1] == "." and not enc[x][y-1]:
            dp[x][y-1] = dp[x][y] + 1
            enc[x][y-1] = True
            q.append([x, y-1])

    res = w - dp[H-1][W-1]
    print(res if dp[H-1][W-1] != 0 else -1)


main()


Measured memory_bytes: 3436
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(int i=0;i<(int)N;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    int N; cin >> N;
    vi d(N);
    rep(i, N) cin >> d[i];

    sort(d.begin(), d.end());

    cout << d[N / 2] - d[N / 2 - 1] << endl;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.nextLine());
		List<Long> list = Arrays.stream(sc.nextLine().split(" ",0)).map(Long::valueOf).collect(Collectors.toList());
		int count = 0;
		boolean hasZero = false;
		for (long i : list) {
			if (i == 0) {
				hasZero = true;
				break;
			} else if (i < 0) {
				count++;
			}
		}

		long out;
		if (hasZero || count%2 == 0) {
			//総和
			out = list.stream().mapToLong(Math::abs).sum();
		} else {
			//
			long min = list.stream().mapToLong(Math::abs).min().getAsLong();
			out = list.stream().mapToLong(Math::abs).filter(i -> i != min).sum() - min;
		}

		System.out.println(out);
		sc.close();
	}

}

Measured memory_bytes: 55292
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int n,road,ans;
vector<int> g[100001];
int high[100001];
int main()
{
	cin>>n>>road;
	for(int i=1;i<=n;i++)
	{
		cin>>high[i];
	}
	while(road--)
	{
		int from,to;
		cin>>from>>to;
		g[from].push_back(to);
		g[to].push_back(from);
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<g[i].size();j++)
		{
			if(high[g[i][j]]>=high[i])
			{
				goto A;
			}
		}
		ans++;
		A:
		continue;
	}
	cout<<ans;
}


Measured memory_bytes: 9160
MOD = 10 ** 9 + 7
def add(a, b):
  return (a + b) % MOD
def sub(a, b):
  return (a - b) % MOD
def mul(a, b):
  return ((a % MOD) * (b % MOD)) % MOD
def div(a, b):
  return ( (a % MOD) * (power(b, MOD)) ) % MOD
def power(a, b):
  return pow(a, b, MOD)


n, k = map(int, input().split())
an = list(map(int, input().split()))
n1 = [0] * n
n2 = [0] * n
for i, v in enumerate(an):
  n1[i] = len([x for x in an[i+1:] if x < v])
  n2[i] = n1[i] + len([x for x in an[:i] if x < v])

cnt = 0
ks = (k-1) * k // 2
for i in range(n):
  cnt = add(cnt, mul(n1[i], k))
  cnt = add(cnt, mul(n2[i], ks))
print(cnt)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    string s;
    cin>>s;
    bool flag = true;
    ll x=0, y=0;
    for(ll i=0;i<s.size();++i){
        if(s[i] == '0'){
            x++;
        }else{
            y++;
        }
    }
    ll ans = min(x, y) * 2;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>
#define int long long
using namespace std;
const int N = 3e5 + 5;
const int mod = 1e9 + 7;
int n, f[N][3][3], ans;
char s[N];
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
signed main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	scanf("%s", s + 1); n = strlen(s + 1); f[0][0][0] = 1;
	for(int i = 0; i < n; i ++)
		for(int j = 0; j < 3; j ++)
			for(int k = 0; k < 3; k ++)
			{
				if(s[i + 1] != '0')
				{
					if(k) f[i + 1][j][k - 1] = (f[i + 1][j][k - 1] + f[i][j][k]) % mod;
					else f[i + 1][min(j + 1, 2ll)][k] = (f[i + 1][min(j + 1, 2ll)][k] + f[i][j][k]) % mod;
				}
				if(s[i + 1] != '1')
				{
					if(k == 2) f[i + 1][j][1] = (f[i + 1][j][1] + f[i][j][k]) % mod;
					else f[i + 1][j][k + 1] = (f[i + 1][j][k + 1] + f[i][j][k]) % mod;
				}
			}
	for(int i = 0; i < 3; i ++) for(int j = 0; j <= i; j ++) ans = (ans + f[n][i][j]) % mod;
	printf("%lld\n", ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 21632
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;
using ll = long long int;

int main(void){
    int N;cin>>N;
    vector<ll> A(N),B(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
        A[i]--;
        B[A[i]]++;
    }
    ll sum = 0;
    for(int i=0;i<N;i++){
        sum += B[i]*(B[i]-1)/2;
    }
    ll ans;
    for(int i=0;i<N;i++){
        ans = sum - (B[A[i]]-1);
        cout << ans << " ";
    }
    return 0;
}

Measured memory_bytes: 5760
#include <stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

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

void merge(int [],int,int,int,int);
void mergeSort(int [],int,int,int);


int main() {
    int a[MAX],n,i;
    
    scanf("%d",&n);
    for(i=0; i<n; i++) scanf("%d",&a[i]);
    
    mergeSort(a,n,0,n);
    
    for(i=0; i<n; i++){
        printf("%d",a[i]);
        if(i<n-1) printf(" ");
    }
    
    printf("\n");
    printf("%d\n",count);
    
    return 0;
}


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


void mergeSort(int a[],int n,int left,int right) {
    int mid;
    
    if(left+1<right){
        mid = (left+right)/2;
        mergeSort(a,n,left,mid);
        mergeSort(a,n,mid,right);
        merge(a,n,left,mid,right);
    }
}

Measured memory_bytes: 4508
#include<cstdio>
#include<bits/stdc++.h>
#define fi first
#define sc second
#define pb push_back


using namespace std;
 
 
int N, A; 
int arr[4][4];
int main() { 
	
	for (int i = 1; i <= 3; i++) {
		for (int j = 1; j <= 3; j++) {
			cin >> arr[i][j];
		}
	}
	bool flag = false;
	for (int a1 = 0; !flag && a1 <= 100; a1++) {
		for (int a2 = 0; !flag && a2 <= 100; a2++) {
			for (int a3= 0; !flag && a3 <= 100; a3++) {
				int b1 = arr[1][1] - a1;
				if (arr[2][1] != a2 + b1) continue;
				if (arr[3][1] != a3 + b1) continue;
				int b2 = arr[1][2] - a1;
				if (arr[2][2] != a2 + b2) continue;
				if (arr[3][2] != a3 + b2) continue;
				int b3 = arr[1][3] - a1;
				if (arr[2][3] != a2 + b3) continue;
				if (arr[3][3] != a3 + b3) continue;
				flag = true;
			} 
		}
	}
	if (flag) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <set>
#define MAXN 222222
#define ll long long
using namespace std;

// 01, 32
// 00, 22

int A[MAXN+2];
ll B[55][55];

double GetLog(int n,int m) {
    if (n==m)
        return 0;
    double Pi=3.1415926535897932384626433832795028842;

    
    if (n < m)
        return 0;
    
    
    if (n <= 50)
        return log(B[n][m]);
    
    
    return n*log(n)-m*log(m)-(n>m?(n-m)*log(n-m):0)+0.5*(log(n)-log(m)-log(n-m)-log(2*Pi));
}


bool myfunc(pair<int,int> x, pair<int,int> y) {
    return (GetLog(x.first,x.second) < GetLog(y.first,y.second));
}

int main() {
    
    for(int i=0;i<55;i++)
        for(int j=0;j<=i;j++) {
            if (j==0)
                B[i][j]=1;
            else
                B[i][j]=B[i-1][j]+B[i-1][j-1];
        }
    
    while(0) {
        int n,m;
        cin>>n>>m;
        printf("%1.10f\n",GetLog(n,m));
        
    }
    
    
    
    int n;
    cin>>n;
    for(int i=0;i<n;i++) {
        cin>>A[i];
    }
    
    sort(A,A+n);
    
    vector<pair<int,int>> cands;
    for(int i=0;i<n;i++) {
        // <= A[i]/2
        int low=0;
        int high=n-1;
        while(low<high) {
            int mid = (low+high+1)/2;
            if (A[mid] > A[i]/2) {
                high=mid-1;
            } else {
                low=mid;
            }
        }
        
        
        // A[mid] or A[mid+1];
        
        if (A[low] < A[i])
            cands.push_back({A[i],A[low]});
        if (low+1<n && A[low+1] < A[i])
            cands.push_back({A[i],A[low+1]});
        
    }
    
    
    sort(cands.begin(),cands.end(),myfunc);
    
    
    cout << cands.back().first << " " << cands.back().second << endl;
    
    
    
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  string a,b; cin >> a >> b;
  string s = a;
  s+=b;
  int ans = stoi(s);

  bool ok = false;
  for(int i = 1;i*i<=ans;++i)
    if(ans==i*i) ok = true;

  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll n, p;
  cin >> n >> p;
  ll r = 1;
  if (n == 1) {
    r = p;
  } else if (n < 40) {
    for (int i = 1; i <= p; i++) {
      ll x = pow(i, n);
      if (x > p) break;
      if (p % x == 0) r = i;
    }
  }
  cout << r << endl;
}


Measured memory_bytes: 256
// Problem : A - We Love Golf
// Contest : AtCoder - AtCoder Beginner Contest 165
// URL : https://atcoder.jp/contests/abc165/tasks/abc165_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

    
/*
CODED BY               
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007
using namespace std;
int main()
{
	fast;
	ll k;
	cin>>k;
		ll n,m;
		cin>>n>>m;
		ll mid1=n/k;
		ll mid2=m/k;
		if(mid2-mid1>=1||k==1||n%k==0||m%k==0)
		cout<<"OK"<<endl;
		else
		cout<<"NG"<<endl;
}






Measured memory_bytes: 3660
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+9;
const llint big=(llint)44e12;//ごめん
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	int n,m,i;cin>>n>>m;
	//連結性判定
	vector<vector<pair<int,llint>>> info(n);
	for(i=0;i<m;i++){
		int l,r;llint d;cin>>l>>r>>d;l--;r--;
		info[l].pub(mp(r,d));
		info[r].pub(mp(l,-d));
	}
	vector<llint>bas(n);
	vector<bool>oto(n);
	queue<pair<int,llint>>que;
	for(i=0;i<n;i++){
		if(oto[i]){continue;}
		que.push(mp(i,0));
		while(que.size()>0){
			int ter=que.front().fir;
			llint gen=que.front().sec;
			que.pop();
			if(oto[ter]&&gen!=bas[ter]){cout<<"No"<<endl;RE;}
			if(oto[ter]){continue;}
			bas[ter]=gen;
			oto[ter]=true;
			for(auto it:info[ter]){que.push(mp(it.fir,gen+it.sec));}
		}
	}
	cout<<"Yes"<<endl;
	RE;
}

Measured memory_bytes: 18152
#include<bits/stdc++.h>
using namespace std;
int A,B;
string S;

bool solve(char a){
  if(a=='0'||a=='1'||a=='2'||a=='3'||a=='4'||a=='5'||a=='6'||a=='7'||a=='8'||a=='9') return true;
  else return false;
}

int main(){
  cin >> A >> B >> S;
  for(int i=0;i<A;i++){
    if(solve(S[i]));
    else{
      cout << "No" << endl;
      return 0;
    }
  }
  if(S[A]!='-'){
    cout << "No" << endl;
    return 0;
  }
  for(int i=A+1;i<=A+B;i++){
    if(solve(S[i]));
    else{
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.List
import Data.Vector.Unboxed (Vector, (!), (//))
import qualified Data.Vector.Unboxed as V
import Data.Vector.Unboxed.Mutable (IOVector, STVector)
import qualified Data.Vector.Unboxed.Mutable as VM

main :: IO ()
main = do
  [n, m] <- f
  solve n <$> replicateM m f >>= print
  where
    f = map read <$> words <$> getLine

solve :: Int -> [[Int]] -> Int
solve n vss = abs . uncurry subtract . foldl' f (0, 0) $ [1..n]
  where
    f (c, v) i
      | tr ! i == (-1) = (c, v+1)
      | tr ! i < (-1) = (c+1, v)
      | otherwise = (c, v)
    tr = runST $ do
      tr <- VM.replicate (n+1) (-1) :: ST s (STVector s Int)
      forM_ vss $ \[x, y] -> do
        unite tr x y
      V.freeze tr

root :: STVector s Int -> Int -> ST s (Int, Int)
root tr i = do
  p <- VM.read tr i
  if p < 0
    then return (p, i)
    else do
      (c, p') <- root tr p
      VM.write tr i p'
      return (c, p')

unite :: STVector s Int -> Int -> Int -> ST s ()
unite tr i j = do
  (ci, pi) <- root tr i
  (cj, pj) <- root tr j
  unless (pi == pj) $ do
    if ci < cj
      then do
        VM.write tr pj pi
        VM.write tr pi (ci + cj)
      else do
        VM.write tr pi pj
        VM.write tr pj (ci + cj)



Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll K, A,B;
    cin >> K >> A >> B;
    if((A/K+1)*K<=B or A%K==0)
        cout << "OK" << endl;
    else
        cout << "NG" << endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){

    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF)
    {
        a=a+b;
        int sum=0;
        while(a!=0)
        {
            sum++;
            a=a/10;
        }
        printf("%d\n",sum);

    }

    return 0;
}



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

#define ONLINE_JUDGE
#define ll long long
#define PI 3.14159265359
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define pb(a) push_back(a)

//////////// Solution /////////////////////////////////

void solve() {
	int l[10];
	int n;
	cin >> n;
	int s = 0, mx = 0;
	for (int i = 0; i < n; ++i) {
		cin >> l[i];
		s += l[i];
		mx = max(mx,l[i]);
	}	

	if (mx < s-mx) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int n,d,a[15][15],ans;
int main(){
	cin>>n>>d;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=d;j++)
			cin>>a[i][j];
	for(int i=1;i<n;i++)
		for(int j=i+1;j<=n;j++)
		{
			int sum=0;
			for(int k=1;k<=d;k++)
			{
				int dif=(a[i][k]-a[j][k]);
				sum+=dif*dif;
			}
			if(int(sqrt(sum))*int(sqrt(sum))==sum)
				ans++;
		}
	cout<<ans;
	return 0;
}

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

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	
	int ans = 1;
	for(int i = 0; i < n; i++) {
		int a = ans * 2;
		int b = ans + k;
		
		ans = min(a, b);
	}
	
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;

int main(void){
    int n;
    int p[10000];
    int max = 0;
    int sum = 0;
    int idx;

    cin >> n;

    for(int i = 0; i < n; i++){
        cin >> p[i];
        if(max < p[i]){
            idx = i;
            max = p[i];
        }
        sum += p[i];
    }

    sum -= p[idx]/2;

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define ff first
#define ss second
#define MAXN  1000005
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,k;
    ll ans=0,e,r,c,d;
    cin>>n>>k;
    if(k==0){
        ans=n*n;
        cout<<ans;
        return 0;
    }
    for(ll i=k+1;i<n+1;i++){
        e=n/i;
        r=n%i;
        c=(i-k)*e;
        d=max(0LL,r-k+1);
        ans+=(c+d);
    }
    cout<<ans;


    return 0;
}



Measured memory_bytes: 256