akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

int N, K;
vector<int> x;

int main()
{
    cin >> N >> K;
    x.resize(N);

    REP(i, N) cin >> x[i];
    int d = distance(x.begin(), lower_bound(x.begin(), x.end(), 0));
    int ans = 1000000000;
    REP(i, N - K + 1) {
        int tmp = x[i + K - 1] - x[i] + min(abs(x[i]), abs(x[i + K - 1]));
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;

int main()
{
    long long m,n;
    scanf("%lld%lld",&m,&n);
    long long sum=0;
    if(2*m>=n)
        sum=n/2;
    else
    {
        sum=m;
        sum+=(n-2*m)/4;
    }
    printf("%lld\n",sum);
    return 0;
}

Measured memory_bytes: 256
<?php
	$arr = str_split(fgets(STDIN));

	foreach ($arr as $char) {
		$code = ord($char);
		if (65 <= $code && $code <= 90) {
			$code += 32;
		} elseif (97 <= $code && $code <= 122) {
			$code -= 32;
		}
		echo chr($code);
	}

Measured memory_bytes: 6772
//                                      KiSmAt
#include "bits/stdc++.h"
using namespace std;
 
using ll = long long;
 
const ll inf = 1e18;
const int mod = 1e9 + 7;
const int N = 2 * 1e3 + 10;

ll res;
ll a[N];
ll dp[N][N];

string s[N];

void solve(){
    ll n, m;
    cin >> n >> m;
    for(int i = 1; i <= n; ++i){
        cin >> s[i];
        s[i] = '#' + s[i];
    }
    dp[0][1] = 1;
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= m; ++j){
            if(s[i][j] == '.') dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
        }
    }
    cout << dp[n][m];
}
 
int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}
// nEro

Measured memory_bytes: 17152
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

long long n,k;
long long a[1000000],f[1000000];
long long b[1000000];

bool train(long long x){
  long long count = 0;
  for(int i=0;i<n;i++){
    if(b[i] > x){
      if((b[i]-x)%f[n-1-i] == 0){
        count += (b[i]-x)/f[n-1-i];
      }
      else{
        count += (b[i]-x)/f[n-1-i]+1;
      }
    }
  }
  if(count <= k) return true;
  return false;
}

long long search_x(long long x_l, long long x_r){
  if(x_l == x_r-1) return x_l;

  if(train((x_l+x_r)/2)){
    return search_x(x_l,(x_l+x_r)/2);
  }
  else{
    return search_x((x_l+x_r)/2,x_r);
  }
  return 0;

}

int main(){
  cin >> n >> k;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<n;i++){
    cin >> f[i];
  }
  sort(a,a+n);
  sort(f,f+n);
  for(int i=0;i<n;i++){
    b[i] = a[i]*f[n-1-i];
  }
  if(train(0)){
    cout << 0 << endl;
    return 0;
  }
  long long ans;
  ans = search_x(0,1000000000000);
  cout << ans+1 << endl;

  return 0;
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
#include<atcoder/all>
#define int long long
using namespace std;
using namespace atcoder;
signed main(){
  int N;
  cin>>N;
  vector<pair<pair<int,int>,int>> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i].first.first>>A[i].first.second;
    A[i].second=i;
  }
  sort(A.begin(),A.end());
  set<pair<int,int>> S;
  dsu D(N);
  for(int i=0;i<N;i++){
    S.insert({A[i].first.second,i});
    bool ok=false;
    for(auto it=S.begin();it!=S.end() && (*it).first<=A[i].first.second;){
      D.merge(A[(*it).second].second,A[i].second);
      if(ok)it=S.erase(it);
      else it++;
      ok=true;
    }
    home:;
  }
  for(int i=0;i<N;i++)cout<<D.size(i)<<endl;
}

Measured memory_bytes: 14380
#include<bits/stdc++.h>
#define MAXN 1e6
using namespace std;

int main()
{
	//freopen("t.txt","r",stdin);
	char c;
	cin>>c;
	if( c=='A')cout<<"T";
	if( c=='C')cout<<"G";
	if( c=='G')cout<<"C";
	if( c=='T')cout<<"A";
	
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define stop char nyaa;cin>>nyaa;

void solve() {
	int n, m, k;
	cin >> n >> m >> k;
	vector<pair<int,int>> p(n);
	rep(i, n) cin >> p[i].first;
	rep(i, n) cin >> p[i].second;
	vector<int> c(n,0);
	rep(i, k) c[n-i-1] = 1;
	int ans = 0;
	do {
		vector<pair<int, int>> v;
		rep(i, n) if (c[i]) v.push_back(p[i]);
		sort(v.begin(), v.end(), greater<pair<int, int>>());
		int tmp = 0;
		int x = m;
		for (int i = 0; i < v.size(); i++) {
			if (v[i].second >= x) {
				tmp += x * v[i].first;
				x = 0;
				break;
			}
			else {
				tmp += v[i].second * v[i].first;
				x -= v[i].second;
			}
		}
		ans = max(ans, tmp+x);
	} while (next_permutation(c.begin(), c.end()));
	cout << ans << endl;
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	stop
		return 0;
}



Measured memory_bytes: 3216
b,i,j;main(n){float a,x;char t[9],l[9];for(;;){for(i=0;i<9;i++)t[i]=l[i]='0';scanf("%f",&a);if(a<0)break;b=a;for(i=0;b;)t[i++]='0'+b%2,b/=2;b=a;a-=b;x=0.5;for(j=0;a>0&&j<5;j++){if(a-x>=0)l[j]='1',a-=x;x/=2;}if(j>4)puts("NA");else{for(b=0;b++<8-i;)printf("0");for(;i;)printf("%c",t[--i]);printf(".");for(;j>i;)printf("%c",l[i++]);for(;4>i++;)printf("0");puts("");}}exit(0);}

Measured memory_bytes: 0
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 200010
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
struct edge{int to,lt;}e[N<<1];
int mx[N],in[N],cnt,sz[N];
void add(int x,int y)
{
	e[++cnt].to=y; e[cnt].lt=in[x]; in[x]=cnt;
	e[++cnt].to=x; e[cnt].lt=in[y]; in[y]=cnt;
}
int tmp[N],d[N],c[N];
void solve(int x,int fr,int val)
{
	tmp[x]=1;
	for(int i=in[x];i;i=e[i].lt)
	{
		int y=e[i].to; if(y==fr||y>val)	continue;
		solve(y,x,val); tmp[x]+=tmp[y];
	}
}
void dfs(int x,int fr)
{
	mx[x]=max(mx[fr],x); sz[x]=1;
	for(int i=in[x];i;i=e[i].lt)
	{
		int y=e[i].to; if(y==fr)	continue;
		dfs(y,x); sz[x]+=sz[y]; d[x]+=d[y];
	}
	if(mx[x]==x)	solve(x,fr,mx[fr]),d[x]=-sz[x];
	if(mx[fr]==fr)	d[x]+=sz[x];
}
void dfs2(int x,int fr)
{
	if(fr)
	{
		if(mx[x]==x)	c[x]=tmp[x];
		else if(mx[fr]==fr)	c[x]=d[x]-tmp[x];
		c[x]+=c[fr];
	}
	for(int i=in[x];i;i=e[i].lt)	if(e[i].to!=fr)	dfs2(e[i].to,x); 
}
int n;
int main()
{
	n=read();
	for(int i=2;i<=n;i++)	add(read(),read());
	dfs(1,0); dfs2(1,0);
	for(int i=2;i<=n;i++)	printf("%d ",c[i]);
	return 0;
}


Measured memory_bytes: 21376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		PrimeNumberGenerator pg = new PrimeNumberGenerator();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		int n2 = n;
		
		while(true){
			boolean divided = false;
			
			int limit = (int)Math.sqrt(n2);
			for(int i = 2; i <= limit ; i++){
				if(!pg.isPrime(i)){
					continue;
				}
				
				if(n2%i == 0){
					n2 /= i;
					list.add(i);
					divided = true;
					break;
				}
			}
			
			if(!divided){
				list.add(n2);
				break;
			}
		}
		
		System.out.print(n+":");
		
		for(int i = 0; i < list.size() ; i++){
			System.out.print(" "+list.get(i));
		}
		System.out.println();
	}

}

class PrimeNumberGenerator {
    private boolean[] isPrime= new boolean[100001];
 
    public PrimeNumberGenerator() {
        //Date from = new Date();
        Arrays.fill(isPrime, true);
 
        isPrime[0] = false;
        isPrime[1] = false;
        isPrime[2] = true;
 
        int limit = (int)Math.sqrt(isPrime.length);
        for(int i = 3; i <= limit; i+=2){
            /*
            if(i % 2 == 0){
                isPrime[i] = false;
                continue;
            }
            */
 
            if(isPrime[i] == false){
                continue;
            }
 
            for(int j = i * 2; j <= isPrime.length - 1; j += i){
                isPrime[j] = false;
            }
        }
        //Date to = new Date();
        //System.out.println("init takes "+ (to.getTime() - from.getTime())+ "milli sec");
    }
 
    public boolean isPrime(int index){
        if(index % 2 == 0 && index != 2){
            return false;
        }
        return isPrime[index];
    }
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
//#define int ll

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

signed main() {
  int n, W;
  cin >> n >> W;
  map<int, int> mp[101];
  int w[101], v[101];

  rep(i, 0, n) cin >> w[i] >> v[i];

  rep(i, 0, n) {
    if(w[i] > W) continue;
    for(auto it = mp[i].begin(); it != mp[i].end(); it++) {
      mp[i + 1][it->first] = max(mp[i + 1][it->first], it->second);
      if(it->first + w[i] > W) continue;
      if(mp[i + 1][it->first + w[i]]) mp[i + 1][it->first + w[i]] = max(mp[i + 1][it->first + w[i]], it->second + v[i]);
      else mp[i + 1][it->first + w[i]] = it->second + v[i];
    }
    if(mp[i + 1][w[i]]) mp[i + 1][w[i]] = max(mp[i + 1][w[i]], v[i]);
    else mp[i + 1][w[i]] = v[i];
  }
  int mx = 0;
  for(auto it = mp[n].begin(); it != mp[n].end(); it++) {
    mx = max(mx, it->second);
  }
  cout << mx << endl;
}


Measured memory_bytes: 4864
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	() => (get().parse::<i64>().unwrap());
    	($t:ty) => (get().parse::<$t>().unwrap());
    }
    
    let n = get!(usize);
    let mut a = vec![];
    let mut b = vec![];
    
    for _ in 0..n {
    	a.push(get!());
    }
    
    for _ in 0..n {
    	b.push(get!());
    }
    
    let mut x = 0;
    for i in 0..n {
        while x < n && b[i] < a[i] {
	        if b[x] - a[x] > 1 {
            	let d = (b[x] - a[x]) / 2;
                let e = a[i] - b[i];
                let f = std::cmp::min(d, e);
                b[i] += f;
                a[x] += f * 2;
            } else {
            	x += 1;
            }
        }
        if b[i] < a[i] {
        	println!("No");
            return;
        }
    }
    
    println!("Yes");
}

Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
char univa[2000][11] = {};
char hogea[11] = {};
int univcnt = 0;
void makearray(int floor,char c,int invfloor){
  hogea[invfloor] = c;
  if (floor == 1){
    hogea[invfloor+1] = '\0';
    strcpy(univa[univcnt],hogea);
    //printf("%s\n",univa[univcnt]);
    univcnt++;
  }else{
    makearray(floor-1,'0',invfloor+1);
    makearray(floor-1,'1',invfloor+1);
  }
}

int main(){
  int n = 0;
  int m = 0;
  int k[10] = {};
  int ks[10][10] = {};
  int ksk = 0;
  int p[10] = {};
  int i = 0;
  int j = 0;
  int swstate[10] = {};
  int state = 0;
  int hogecnt;
  int cnt = 0;
  int succnt = 0;
  
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++){
    scanf("%d",&k[i]);
    for(j=0;j<k[i];j++){
      scanf("%d",&ksk);
      ks[i][ksk-1] = 1;
    }
  }
  for(i=0;i<m;i++){
    scanf("%d",&p[i]);
  }
  makearray(n,'0',0);
  makearray(n,'1',0);
  for(state=0;state<univcnt;state++){ //スイッチ状態
    succnt = 0;
    //
    for(j=0;j<n;j++){
      swstate[j] = univa[state][j] - '0';
      //printf("%d",swstate[j]);
    }
    //
    //printf("//");
    for(i=0;i<m;i++){
      hogecnt = 0;
      for(j=0;j<n;j++){
        if(ks[i][j] == 1 && swstate[j] == 1){
          hogecnt++;
        }
      }
      
      if(hogecnt % 2 == p[i]){
        succnt++;
      }
    }
    if(succnt == m){
      cnt++;
    }
  }
  printf("%d",cnt);
          
          
    
    
  return 0;
}
  
  
    
    

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
Int mod = 1e9+7;

int main() {
    Int n, m;
    cin >> n >> m;
    vector<Int> g(n + 2, 0);
    for (Int i = 0; i < m; i++) {
        Int l, r;
        cin >> l >> r;
        g[l]++;
        g[r + 1]--;
    }
    for (Int i = 1; i <= n - 1; i++) {
        g[i + 1] += g[i];
    }
    Int res = 0;
    for (Int i = 1; i <= n; i++) {
        if (g[i] == m) res++;
    }
    dump(res);
    return 0;
}

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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n,0);
vector<ll> b(n,0);
rep(i,n){
  cin >> a[i] >> b[i];
}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
if(n%2){
  ans=b[n/2]-a[n/2]+1;
}
else ans=b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1;
cout << ans << endl;
return 0;
}

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

int main(){
    int N;
    cin >> N;
    N-=1;
    vector<int> B(N);
    rep(i,N)cin >> B[i];

    int sum = B[0];
    rep(i,N-1){
        sum += min(B[i],B[i+1]);
    }
    sum +=B[N-1];
    cout << sum;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <algorithm> //sort()

using namespace std;

long a, b, c, d, i, j, k, n;


int main(){
//////////////////////////////////////////////////////


    //cout << "Hello, World!" << endl;

    cin >> n >> k;

    // cout << "n:" << n << endl;

    // vector<long> input(n);
    // for (int i = 0 ; i < n ; i ++ )
    // {
    //     cin >> input[i];
        // cout << "input[" << i << "]=" << input[i] << endl;
    // }

    // sort(input.begin() , input.end());

    // uint64_t max = numeric_limits<uint64_t>::max();



    // long sum = 0;
    // for ( int i = 0 ; i < n ; i ++ )
    // {
    //     sum += i;
    // }






    cout <<  n - k + 1    << endl;

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}




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

int main(void){
long long int h;
int x=0;
scanf("%lld",&h);
for(int i=0;;i++){
    h=h/2;
    x++;
    if(h==0){break;}
}
printf("%lld\n",(long long int)pow(2,x)-1);

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int dp[100005];
int n,k;
int inf = 1e9;
int solve(int i)
{
    if(i>=n)
    return inf;
    if(i==n-1)
    return 0;
    if(dp[i]!=-1)
    return dp[i];
    int ans = inf;
    for(int v=1;v<=k;v++)
    ans = min(ans,abs(a[i]-a[i+v])+solve(i+v));
    return dp[i]=ans;
}
int main() {
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        dp[i]=-1;
    }
    cout<<solve(0);
}


Measured memory_bytes: 12140
f i d =
  let m = d `mod` i
      v = d `div` i
      n = f (i+1) d
  in
    if v < i
    then []
    else if m /= 0
         then n
         else if v == i
              then [v]
              else (i:v:n)

ans d =
  let y = f 2 d
      y'= if d == 1 then y else (1:y)
      s = sum y'
  in
    if d > s then "deficient number"
    else if d == s then "perfect number" else "abundant number"

main = do
  c <- getContents
  let i = takeWhile (/= 0) $ map read $ lines c :: [Int]
      o = map ans i
  mapM_ putStrLn o



Measured memory_bytes: 4340
N = int(input())
h = [0] + list(map(int, input().split()))
ans = [0]*(N+1)

ans[2] = abs(h[1]-h[2])
for i in range(3, N+1):
    ans[i] = min(ans[i-1] + abs(h[i]-h[i-1]), ans[i-2] + abs(h[i]-h[i-2]))
print(ans[N])

Measured memory_bytes: 20408
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long X = sc.nextLong();
		long K = sc.nextLong();
		long D = sc.nextLong();
		long t = Math.abs(X) / D;
		long r = K - t;
		long ans = 0;
		if (X >= 0) {
			if (r <= 0) {
				ans = X - D * K;
			} else {
				if (r % 2 == 0) {
					ans = X - D * t;
				} else {
					ans = X - D * (t + 1);
				}
			}
		} else {
			if (r <= 0) {
				ans = X + D * K;
			} else {
				if (r % 2 == 0) {
					ans = X + D * t;
				} else {
					ans = X + D * (t + 1);
				}
			}
		}
		System.out.println(Math.abs(ans));
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 32464
#include <stdio.h>

int main(void) {
	int n,i,j,k,l,ans;
	while (scanf("%d",&n)!=EOF){
		ans=0;
		for (i=0;i<10;i++){
			for (j=0;j<10;j++){
				for (k=0;k<10;k++){
					for (l=0;l<10;l++){
						if (i+j+k+l==n)
							ans++;
					}
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;


ll dp[1005][(1<<12)+5];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  ll ans=(n+1)*n/2-n;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
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; }

string s;

int main(void){
    cin >> s;
    lli l, r;
    l = 0, r = s.size()-1;
    lli ans = 0;
    while(r-l > 0){
        if(s[l] == s[r]) l++, r--;
        else if(s[l] == 'x') ans++, l++;
        else if(s[r] == 'x') ans++, r--;
        else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3748
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();
    int N = sc.nextInt();
    for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    System.out.println(Math.abs(ar.get(0)-ar.get(N-1)));
  }
}


Measured memory_bytes: 23380
#include<stdio.h>
int main(void) {
	int a, b;
	scanf("%d %d", &a, &b);
	if (a < b) {
		printf("a < b\n", a, b);
	}
	else if (a > b) {
		printf("a > b\n", a, b);
	}
	else if (a == b) {
		printf("a == b\n", a, b);
	}
	return 0;
}

Measured memory_bytes: 580
//============================================================================
// Name        : AOJ.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;
typedef long long ll;
int main(){


	char c11,c12,c13,c21,c22,c23,c31,c32,c33;

	cin>>c11>>c12>>c13;
	cin>>c21>>c22>>c23;
	cin>>c31>>c32>>c33;


	cout<<c11<<c22<<c33<<endl;



	return 0;



}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());
// map<int,int> mp;

int main() {
  string n;
  cin >> n;
  char i = n.at(n.size() - 1);

  if (i == '3') {
    cout << "bon" << endl;
  } else if (i == '0' || i == '1' || i == '6' || i == '8') {
    cout << "pon" << endl;

  } else {
    cout << "hon" << endl;
  }
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <deque>

#define mp make_pair
#define x first
#define y second
#define pb push_back
using namespace std;

const int N = 5e3+5;
int n, f[N][N], ans;
char s[N];

int main()
{
    cin >> n >> (s+1);
    for(int i=1; i<n; ++i) for(int j=i+1; j<=n; ++j) {
        f[i][j] = (s[i]==s[j]) ? f[i-1][j-1]+1 : 0;
        ans = max(ans, min(f[i][j], j-i));
    }
    cout << ans;
}


Measured memory_bytes: 96768
//#pragma GCC optimize("O2")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const int maxn = 2e5 + 55;
const int mod = 1e9 + 7;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, m;
	cin >> n >> m;
	cout << ((n==m)?"Yes":"No");
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
 
using namespace std;

/* constant */

const double PI = acos(-1);

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  for (;;) {
    double r;
    cin >> r;
    if (r == 0.0) break;

    int num, den;
    
    for (den = 1;; den++) {
      double pd = PI * den;
      double num0 = floor(pd);
      double num1 = ceil(pd);
      double pi0 = num0 / den;
      double pi1 = num1 / den;
      double r0 = abs(PI - pi0);
      double r1 = abs(PI - pi1);
      //printf("den=%d: num0=%d, num1=%d, r0=%.6lf, r1=%.6lf\n",
      //den, (int)num0, (int)num1, r0, r1);

      if (r0 <= r || r1 <= r) {
	if (r0 < r1) num = num0;
	else num = num1;
	break;
      }
    }

    printf("%d/%d\n", num, den);
  }

  return 0;
}

Measured memory_bytes: 1212
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  ll L, R;
  cin >> L >> R;

  int ans = 100000000;
  if(L / 2019 != R / 2019){
    ans = 0;
  } else {
    for(int i = L % 2019; i < R % 2019; i++){
      for(int j = i + 1; j <= R % 2019; j++){
        ans = min(ans, (i * j) % 2019);
      }
    }
  }

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


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

using namespace std;

int main()
{
    int n, m, t;
    cin >> n >> m >> t;
    int res = t;
    int p;
    cin >> p;
    for(int i=1; i<n; i++)
    {
        int q;
        cin >> q;
        int d = q - p;
        res -= min(d, 2 * m);
        p = q;
    }
    res -= m;
    res -= min(m, t-p);
    cout << res << endl;
}

Measured memory_bytes: 3040
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;

void dfs(vector<int> A){
	if(A.size() == n){
		int now = 0;
		rep(i,q){
			if(A[b[i]-1] - A[a[i]-1] == c[i]) now+= d[i];
		}
	ans = Max(ans, now);
	return;
	}

	A.push_back(A.back());
	while(A.back() <= m){
		dfs(A);
		A.back()++;
	}
	return;
}
int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	cin >> n >> m >> q;
	a = b = c = d = vector<int>(q);
	rep(i,q){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	dfs(vector<int>(1,1));
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3604
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <regex>
#include <numeric>

#define M_PI       3.14159265358979323846

using namespace std;

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 998244353

int main() {
	int n, m, q;
	cin >> n >> m >> q;
	VVI a(n+1);
	REP(i, m) {
		int l, r;
		scanf("%d%d", &l, &r);
		a[l].PB(r);
	}
	REP(i, n+1) SORT(a[i]);
	REP(i, q) {
		int l, r;
		scanf("%d%d", &l, &r);
		int ret = 0;
		FOR(s, l, r + 1) {
			ret += distance(a[s].begin(), upper_bound(ALL(a[s]), r));
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    std::cin >> n;
    long long sum=0LL;
    long long a[100002],b[100001];
    for (int i = 1; i <= n+1; i++) {
        std::cin >> a[i];
        sum+=a[i];
    }
    for (int i = 1; i <= n; i++) {
        std::cin >> b[i];
    }
    long long ans=0LL;
    for (int i = 1; i <= n; i++) {
        long long tmp=b[i]-a[i];
        a[i]=max(a[i]-b[i],0LL);
        if(tmp>0){
            a[i+1]=max(a[i+1]-tmp,0LL);
        }
    }
    for (int i = 1; i <= n+1; i++) {
        ans+=a[i];
    }
    std::cout << sum-ans << std::endl;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;

int main() {
	/*
	int a = 0;//整数変数aを作る
	int b = 0;//整数変数bを作る

	cin >> a >> b;//2つの数字を受け取り、a,bに代入

	cout << a * b << endl;//a*bを出力
	*/
	/*
	string S;
	cin >> S;
	if (S[0]=='7'||S[1]=='7'||S[2]=='7') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	int a = 0;
	int b = 0;
	int ans = 0;

	cin >> a >> b;

	int apb = a + b;
	int akb = a * b;
	int amb = a - b;
	ans = apb;
	if (ans < a - b) {
		ans = a - b;
	}


	if (ans < a * b) {
		ans = a * b;
	}
	cout << ans << endl;

	int N = 0;
	int R = 0;
	int Ans = 0;
	cin >> N >> R;
	if (N >=10) {
		Ans = R;
	}
	else
	{
		Ans = R + (100 * (10 - N));
	}

	cout << Ans << endl;
	
	int A = 0;
	cin >> A;
	cout << A + (A * A) + (A * A * A) << endl;

    ==は右と左が同じかの判定をする
	＝は代入する
	%は余りを求めるときに使う。ex)k=12%7   kは5となる。
	

	int a, b, x;

	cin >> a >> b ;

	x = (a + b +1) / 2;

	cout << x << endl;o
	 */
	int N, X, T, i;
	cin >> N >> X >> T;
	if( N%X==0){
		i = N / X;
	}
	else
	{
		i = N / X + 1;
	}
	cout << T * i << endl;
	




	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define pf push_front
#define F first
#define S second
#define lp(i, a, b) for (int i=a;i<=(int)b;++i)
#define lp2(i, a, b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define pr(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define clr(c, x) memset(c,x,sizeof(c));
template<class T> using OS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int N = (int) 2e5 + 5;
const ll mod = 998244353;

int main() {
    FAST;
    int a, b;
    cin >> a >> b;
    if (a <= 5) cout << 0 << "\n";
    else if (a > 5 && a < 13) cout << b / 2 << "\n";
    else cout << b << "\n";
    return 0;
}

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

typedef long long ll;

const ll        MOD=1000000007;  ///1e9+7

#define forn(i,n) for(i=0;i<n;i++)
#define mem(a,b) memset(a, b, sizeof(a))

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///
ll h,w,dp[1000][1000];
string a[1000];

ll rec(ll x,ll y)
{
    if(x>=h or y>=w) return 0;
    if(a[x][y]=='#') return 0;
    if(dp[x][y]>-1) return dp[x][y]%MOD;
    dp[x][y]=rec(x+1,y)+rec(x,y+1);
    return dp[x][y]%MOD;
}

void _case()
{
    cin>>h>>w;
    ll i;
    forn(i,h) cin>>a[i];
    mem(dp,-1);
    dp[h-1][w-1]=1;
    cout<<rec(0,0)<<'\n';
}

main()
{
        fastio();
        _case();
}


///Thank you.


///Brainless_Loco Terminates Here!


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

int main(){
  int dp[1401][1401]={0},min,max,a,w,h;
  cin>>h>>w;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin>>a;
      if(a==0)dp[i][j]=-1;
    }
  }
  /*for(int i=0;i<=h;i++){/////
    for(int j=0;j<=w;j++){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
    }*/
  max=0;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      if(dp[i][j]==-1){
	//cout<<"??????"<<" ";//////
	min=dp[i-1][j];
	if(min>dp[i-1][j-1])min=dp[i-1][j-1];
	
	if(min>dp[i][j-1])min=dp[i][j-1];
	dp[i][j]=min+1;
	if(dp[i][j]>max)max=dp[i][j];
      }//else cout<<"??????"<<" ";/////
    }
    //cout<<endl;/////
  }
  /*for(int i=0;i<=h;i++){/////
    for(int j=0;j<=w;j++){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }*/
  cout<<max*max<<endl;
  return 0;
}

Measured memory_bytes: 10780
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

void _main() {
  int N, K;
  cin >> N >> K;
  if (K <= (N/2 + N%2)) cout << "YES" << "\n";
  else                  cout << "NO" << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
using namespace std;
int main() {
	int W, a, b;
	cin >> W >> a >> b;
	if (abs(a - b) <= W) {
		cout << 0 << endl;
	}
	else if (b - (a + W) > a - (b + W)) {
		cout << b - (a + W) << endl;
	}
	else if (b - (a + W) < a - (b + W)) {
		cout << a - (b + W) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
from collections import Counter

n, m = map(int, input().split())
a = list(map(int, input().split()))
SUM = [0]

for i in a:
    SUM.append((SUM[-1]+i)%m)

#SUM.pop(0)
c = Counter(SUM)
C = c.most_common()
C_srt = sorted(C)
ans = 0

for i in C:
    if i[1] > 1:
        '''
        if i[0] == 0:
            ans += i[1]*(i[1]+1)//2
        else:
        '''
        ans += i[1]*(i[1]-1)//2
    else:
        break
print(ans)


Measured memory_bytes: 19624
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<vector>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=4e18;
const ll MOD=1e9+7;
const double EPS=1e-7;

ll N,K;
P xy[100];
int main(){
    cin>>N>>K;
    for(ll i=0;i<N;i++){
        ll x,y;
        cin>>x>>y;
        xy[i]=P(x,y);
    }
    sort(xy,xy+N);
    ll ans=INF;
    for(ll i=0;i<N;i++){
        for(ll j=N-1;j>=i+K-1;j--){
            vector<P> v;
            for(ll k=i;k<=j;k++){
                v.push_back(P(xy[k].second,xy[k].first));
            }
            ll w=xy[j].first-xy[i].first;
            sort(v.begin(),v.end());
            for(ll k=0;k<=v.size()-K;k++){
                ll h=v[k+K-1].first-v[k].first;
                ans=min(ans,h*w);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <string.h>
#include <iostream>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <algorithm>

#define rep(i, j, n) for (int i = j; i < n; i++)
#define rep_nested(i, s, n) for (ull i = s; i <= n; i++)
#define ll long long
#define ull unsigned long long

const int N = 500;
const ll INF = 1e9 + 7;

using namespace std;

template <class T>
T limit(T n, T k) {
	return (n > k) ? k : n;
}

template <class T>
T has_order(T a, T b, T c) {
	return (b > a && b < c) || (b < a && b > c);
}

template <class T>
float points_distance(T a) {
	return sqrt(a);
}

template <class T>
T is_integer(T a) {
	return floor(a) == a;
}

int main() {
	int n, k;
	ull count = 0;
	
	cin >> n;
	
	vector<int> a(n + 1, 0);
	vector<int> b(n, 0);
	
	rep(i, 0, n + 1) cin >> a[i];
	rep(i, 0, n) cin >> b[i];
	
	for (int i = 0; i < n; i++) {
		k = (a[i] >= b[i]) ? b[i] : a[i];
		b[i] -= k;
		
		count += k;
		
		k = a[i + 1] - b[i];
		
		if (k < 0) {
			count += a[i + 1];
			a[i + 1] = 0;
		} else {
			a[i + 1] -= b[i];
			count += b[i];
		}
	}
	
	cout << count << endl;
	
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
h = list(map(int, input().split()))

step = 0
max_num = 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        step += 1
        max_num = max(step, max_num)
    else:
        step = 0
        

print(max_num)




Measured memory_bytes: 20496
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
typedef vector< int > vi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef vector< ll > vll;
// #define DEBUG_MODE
#ifdef DEBUG_MODE
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(x) fprintf(stderr, "[%s = %d]\n", #x, x)
#else
	#define errp(...)
	#define dbg(x) 
#endif

const int N = 1010;
const ll MOD = (int)1e9 + 7;

bool is_prime[N];
int n;
vii primes;


ll mul_mod (ll a, ll b) {
	return ((a % MOD) * (b % MOD)) % MOD;
}

void solve (int x) {
	for (int i = 0; i < primes.size(); i++) {
		while (x % primes[i].first == 0) {
			x /= primes[i].first;
			primes[i].second++;
		}
	}
}

void sieve () {
	memset(is_prime, true, sizeof is_prime);
	is_prime[1] = false;
	for (int i = 2; i < N; i++) if (is_prime[i]) {
		for (int j = i + i; j < N; j += i)
			is_prime[j] = false;
	}
}


int main () { 
#ifdef DEBUG_MODE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	sieve();
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) if (is_prime[i])
		primes.emplace_back(i, 0);
	for (int i = 1; i <= n; i++) solve(i);
	ll res = 1;

	//for (ii p : primes) printf("(%d : %d)\n", p.first, p.second);
	for (int i = 0; i < primes.size(); i++) {
		res = mul_mod(res, primes[i].second + 1);
	}
	printf("%lld\n", res);

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define INF 1e9

int main(){
    //freopen("A.in", "r", stdin);
    //freopen("A.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n, d, cnt = 0;
    cin >> n >> d;
    for(int i = 0; i < n; ++i){
        ll a, b;
        cin >> a >> b;
            if(sqrt(a*a + b*b) - double(d) <= double(0)) {
                    ++cnt;
            }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3696
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(int(a/b))
    else:
        break


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
vector<int> divisor(Int x)
{
    vector<int> ans;
    for (int i = 1; i*i <= x; i++) {
        if (x % i == 0) {
            ans.push_back(i);
            if (i*i != x) ans.push_back(x/i);
        }
    }
    sort(begin(ans), end(ans));
    return ans;
}
int main()
{
    int N, K; cin >> N >> K;
    vector<int> A(N); for (auto &a : A) cin >> a;
    Int sum = accumulate(begin(A), end(A), 0LL);
    auto ds = divisor(sum);
    reverse(begin(ds), end(ds));
    vector<int> B(N);
    for (auto d : ds) {
        for (int i = 0; i < N; i++) B[i] = A[i] % d;
        Int sum2 = accumulate(begin(B), end(B), 0LL);
        sort(begin(B), end(B));
        Int k = accumulate(begin(B), begin(B) + N - sum2 / d, 0LL);
        if (k <= K) {
            cout << d << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s,a;
	cin>>s;
	for(int i=0;i<s.length();i++){
		if(s[i]=='0'){
			a+='0';
		}
		else if(s[i]=='1'){
			a+='1';
		}
		else if(a.length()!=0)a.erase(a.length()-1);
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx")
#include <bits/stdc++.h>

constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

vector<ll> ed(ll n) { // 約数列挙
	vector<ll> ans;
	for (int i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ans.push_back(i);
			if (i != 1 && i * i != n)ans.push_back(n / i);
		}
	}
	return ans;
}
int main() {
	int N;
	cin >> N;
	vector<int> A(N + 1), B(N + 1, 0), C(N + 1, 0), ans;
	for (int i = 0; i < N; i++)cin >> A[i+1];
	for (int i = N; i >= 1; i--) {
		if ((A[i] == 1 && B[i] % 2 == 0) || (A[i] == 0 && B[i] % 2 == 1)) {
			B[i]++;
			C[i]++;
			auto c = ed(i);
			for (int j = 0; j < c.size(); j++)B[c[j]]++;
			ans.push_back(i);
		}
	}
	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); i++)cout << ans[i] << endl;
	/*
	for (int i = 1; i <= N; i++)cout << C[i] << " ";
	cout << endl;
	for (int i = 1; i <= N; i++)cout << B[i] << " ";
	cout << endl;*/
}

Measured memory_bytes: 3832
N = gets.to_i

n = 1
base = 26
rui = [0]
keta = 0

while rui.last < N
  n *= base
  keta += 1
  rui << rui.last + n
end

v = N - (rui[-2] + 1)

puts v.to_s(26).rjust(keta, '0').chars.map.with_index { |x, idx|
  ('a'.ord + x.to_i(26)).chr
}.join


Measured memory_bytes: 14416
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void)
{
	int a, b; cin >> a >> b;
	int tmp, sml, ans = 0;

	if (a > b) {
		ans += a;
		a--;
	}
	else
	{
		ans += b;
		b--;
	}

	if (a > b) {
		ans += a;
	}
	else
	{
		ans += b;
	}
	
	cout << ans << endl;
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, ans =0;
	cin >> n;
	cout <<  3*n*n <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;

const ll MAX = 2e5;

ll L[MAX / 2 + 2], R[MAX / 2 + 2];

ll merge(vector<ll> &A, ll left, ll mid, ll right)
{
    ll i, j;
    ll cnt = 0;
    ll n1 = mid - left;
    ll 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] = INF;
    i = j = 0;
    for (ll k = left; k < right; k++) {
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
            cnt += n1 - i;
        }
    }
    return cnt;
}

ll mergeSort(vector<ll> &A, ll left, ll right)
{
    ll mid;
    ll v1, v2, v3;
    if (left + 1 < right) {
        mid = (left + right) / 2;
        v1 = mergeSort(A, left, mid);
        v2 = mergeSort(A, mid, right);
        v3 = merge(A, left, mid, right);
        return v1 + v2 + v3;
    } else {
        return 0;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) { cin >> a[i]; }

    ll ans = mergeSort(a, 0, n);
    cout << ans << endl;
    return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  if(N == 1){
    cout << "Hello World" << endl;
  }
  else{
    int x, y;
    cin >> x >> y;
    cout << x+y << endl;
  }

  return 0;
}


Measured memory_bytes: 256
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <stdio.h>
//end of libraries ;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define INF 3999999999999999999
#define N 3000003
#define PI 3.14159265359
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int n;
set<string>st;
int main(){
fcin;	
	cin>>n;
	while(n--){
		string s;
		cin>>s;
		st.insert(s);
	}
	cout<<st.size()<<"\n";


}

Measured memory_bytes: 19200