akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	int n;
	cin >> n;
	if (n % 2 == 0) { n /= 2; n -= 1; }
	else n /= 2;

	cout << n << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)

//your code here!
ll fib(ll steps){
    if(steps<0) return 0;
    ll x0=0, x1=1, ret=1;
    rep(_, steps){
        ret = (x0+x1)%MOD;
        x0 = x1;
        x1 = ret;
    }
    return ret;
}
int main(void){
    ll N, M, a[100100], ans=1;
    scanf("%lld %lld", &N, &M);
    if(M==0){
        printf("%lld\n", fib(N));
        return 0;
    }
    rep(i, M) scanf("%lld", a+i);
    rep(i, M+1){
        if(i==0)      ans *= fib(a[0]-1);
        else if(i==M) ans *= fib(N-1-a[M-1]);
        else          ans *= fib(a[i]-a[i-1]-2);
        ans %= MOD;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include<string>
#include<iomanip>


using namespace std;

int loop(int i) {
	int j = 0;
	while (i > 0) {
		j += i % 10;
		i /= 10;
	}
	return j;
}

int main(void) {
	int n;
	int a, b;
	int i;
	int j=0;
	int s = 0;

	cin >> n>>a >> b;

	

	for (i = 1; i <= n; i++) {
		j = loop(i);

		if (j >= a && j <= b)
			s = s + i;
	}

	cout << s;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=3000 +117;
const int MM= +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
LL a[NN][NN]={};
int seq[NN]={};
const int mod=1e9+7;
int main(){
	//open();
	n=read();
	int q=read();
	for(int i=1;i<=n;++i)seq[i]=read();
	for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j){
			a[i][j]=(seq[i]>seq[j]?1:0);
		}
	}
	int rev2=(mod+1)>>1;
	for(int i=1;i<=q;++i){
		int x=read(),y=read();
		for(int i=1;i<=n;++i){
			if(i!=y&&i!=x){
				a[y][i]=a[x][i]=rev2*(a[x][i]+a[y][i])%mod;
				a[i][y]=a[i][x]=rev2*(a[i][x]+a[i][y])%mod;
			}
		}
		a[y][x]=a[x][y]=rev2*(a[y][x]+a[x][y])%mod;
	}
	LL ans=0;
	for(int i=1;i<=n;++i){
		for(int j=i+1;j<=n;++j){
			ans+=a[i][j];
			ans%=mod;
		}
	}
	for(int i=1;i<=q;++i){
		ans=ans*2%mod;
	}
	printf("%lld\n",ans);
	close();
	return 0;
}

Measured memory_bytes: 73984
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V vec(n);
    rep(i, n) cin >> vec[i];
    ll small = 1e9;
    ll cnt = 0;
    rep(i,n){
        if(small>=vec[i]){
            cnt++;
            small = vec[i];
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1792
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        x: isize, n: usize,
        p_vec: [isize; n]
    }

    let all_num: HashSet<isize> = (-1000..=1000).collect();
    let p_set: HashSet<isize> = p_vec.into_iter().collect();

    let diff: HashSet<&isize> = all_num.difference(&p_set).collect();

    let mut min: isize = 1e9 as isize;
    let mut ans: isize = 0;

    for d in diff.iter() {
        dbg!(&d);
        if min > (x - **d).abs() {
            ans = **d;
            min = (x - **d).abs();
        } else if min == (x - **d).abs() {
            if **d < ans {
                ans = **d;
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2336
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var r = int.Parse(Console.ReadLine());
    double k = r*2*3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067;

    Console.WriteLine(k);
    
   
  }
}

Measured memory_bytes: 18640
#include <stdio.h>

int main(){
    int N;
    scanf("%d",&N);
    int A[N],B[N],C[N-1];
    for (int i = 0; i < N; i++)
    {
        scanf("%d",&A[i]);
    }
    for (int i = 0; i < N; i++)
    {
        scanf("%d",&B[i]);
    }
    for (int i = 0; i < N-1; i++)
    {
        scanf("%d",&C[i]);
    }
    int sum = 0;
    for (int i = 0; i < N; i++)
    {
        int id = A[i];
        sum += B[id-1];
        if (i > 0)
        {
            if (A[i] - A[i-1] == 1)
            {
                sum += C[A[i-1]-1];
            }            
        }        
    }

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

Measured memory_bytes: 128
M, K = map(int, input().strip().split(' '))

MAX = 2 ** M

if K == 0:
  s = ' '.join(['{0} {0}'.format(i) for i in range(MAX)])
elif M == 1:
  s = '-1'
elif K < MAX:
  tmp = [i for i in range(MAX) if i != K]
  a = ' '.join(map(str, tmp))
  b = ' '.join(map(str, reversed(tmp)))
  s = '{0} {1} {0} {2}'.format(K, a, b)
else:
  s = '-1'

print(s)

Measured memory_bytes: 17964
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    p = [0] * n
    p[0] = sum(a) - 2 * sum(a[1::2])
    for i in range(1, n):
        p[i] = 2 * a[i - 1] - p[i - 1]
    print(" ".join([str(i) for i in p]))


if __name__ == "__main__":
    solve()

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;

const int MD = 924844033;

int add(int a, int b) {
    return (a += b - MD) < 0 ? a + MD : a;
}

int mul(int a, int b) {
    return ll(a) * b % MD;
}

int n, m;
VV<int> g;
V<int> fac, ifac;
V<int> cnt;

int power(int x, int n) {
    int r = 1;
    while (n) {
        if (n & 1) r = mul(r, x);
        x = mul(x, x);
        n >>= 1;
    }
    return r;
}

const int root = power(5, (MD - 1) >> 21);

int binom(int x, int y) {
    if (x < y) return 0;
    return mul(fac[x], mul(ifac[y], ifac[x-y]));
}

int dfs(int v, int p = -1) {
    int s = 1;
    for (int u : g[v]) {
        if (u == p) continue;
        int c = dfs(u, v);
        cnt[c]++;
        s += c;
    }
    cnt[n-s]++;
    return s;
}

void fft(int n, V<int> &a) {
    V<int> rev(n);
    int lg = __builtin_ctz(n);
    for (int i = 0; i < n; i++) {
        rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (lg - 1));
    }
    for (int i = 0; i < n; i++) {
        if (i < rev[i]) swap(a[i], a[rev[i]]);
    }
    V<int> roots(n);
    roots[0] = 1;
    for (int t = 0; (1 << t) < n; t++) {
        int k = 1 << t;
        roots[1] = power(root, 1 << (20-t));
        for (int i = 2; i < k; i++) {
            roots[i] = mul(roots[i-1], roots[1]);
        }
        for (int i = 0; i < n; i += k << 1) {
            for (int j = 0; j < k; j++) {
                int z = mul(roots[j], a[i+j+k]);
                a[i+j+k] = add(a[i+j], MD-z);
                a[i+j] = add(a[i+j], z);
            }
        }
    }
}

V<int> multiply(int A, const V<int> &a, int B, const V<int> &b, bool eq = false) {
    int n = 1;
    while (n < A + B - 1) n <<= 1;
    V<int> fa(n), fb(n);
    for (int i = 0; i < A; i++) fa[i] = a[i];
    fft(n, fa);
    if (eq) fb = fa;
    else {
        for (int i = 0; i < B; i++) fb[i] = b[i];
        fft(n, fb);
    }
    int inv_n = power(n, MD - 2);
    for (int i = 0; i < n; i++) {
        fa[i] = mul(fa[i], mul(fb[i], inv_n));
    }
    reverse(fa.begin() + 1, fa.end());
    fft(n, fa);
    fa.resize(A + B - 1);
    return fa;
}

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

    fac = ifac = V<int>(n+1);
    fac[0] = 1;
    for (int i = 1; i <= n; i++) {
        fac[i] = mul(fac[i-1], i);
    }
    ifac[n] = power(fac[n], MD - 2);
    for (int i = n - 1; i >= 0; i--) {
        ifac[i] = mul(ifac[i+1], i+1);
    }

    g = VV<int>(n);
    for (int i = 0; i < n-1; i++) {
        int a, b;
        scanf("%d %d", &a, &b); a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    cnt = V<int>(n+1);
    dfs(0, -1);

    V<int> c(n+1), d(n+1);
    for (int i = 1; i <= n; i++) {
        c[i] = mul(cnt[i], fac[i]);
        d[i] = ifac[n-i];
    }
    c = multiply(n+1, c, n+1, d);
    for (int k = 1; k <= n; k++) {
        int res = mul(n, binom(n, k));
        res = add(res, MD - mul(ifac[k], c[n+k]));
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 31232
N = int(input())
S = input()

cnt = 0
ans = 10 ** 10

for i in range(1, N):
    if S[i] == "E":
        cnt += 1

ans = min(ans, cnt)

for i in range(1, N):
    if S[i - 1] == "W":
        cnt += 1
    if S[i] == "E":
        cnt -= 1
    ans = min(ans, cnt)

print(ans)


Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
    for(auto &e:t) fill_v(e,v);
}

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

  int ans = 0;
  REP(x, k+1)REP(y, k+1){
    if(x + y <= s && x + y >= s - k) ans++;
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;




int main(){
    

    int N,M;
    cin >> N >> M;
    vector<pair<int,int> > E(M);
    rep(i,M){
        int a, b;
        cin >> a >> b;
        
        E[i].first = a;
        E[i].second = b;
        
    }
    
    sort(all(E));
    int b = E[0].first;
    int e = E[0].second;
    int ans = 1;
    
    for (int i = 1; i < M; i++) {
        if (E[i].second < e) {
            e = E[i].second;
            b = E[i].first;
        }else if(E[i].first < e){
            b = E[i].first;
        }else{
            e = E[i].second;
            b = E[i].first;
            ans += 1;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 100000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

lo n,m,b[li],a[li],k,flag,t,cevap,cevap1,cevap2,cevap3,mn=inf;
lo cev;
string s;
vector<int> v;

int main(void){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
		cev+=a[i];
	}
	sort(a+1,a+n+1);
	for(lo i=a[1];i<=a[n];i++){
		cev=0;
		for(lo j=1;j<=n;j++){
			cev+=abs(a[j]-i)*abs(a[j]-i);
		}
		mn=min(mn,cev);
	}
	printf("%lld\n",mn);
	return 0;
}


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

int main() {
	// your code goes here
	ll h,w;
	cin >> h >> w;
	if (h == 1 || w == 1) {
	    cout << 1 << "\n";
	} else {
	    ll res = ceil((double)h * w / 2);
	    cout << res << "\n";
	}
}


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

int main(){
  string S;
  cin >> S;
  int a[26]={};
  for(int i=0;i<S.length();i++){
    a[S[i]-'a']++;
  }
  bool ans=true;
  for(int i=0;i<26;i++){
    if(a[i]>1){
      ans=false;
      break;
    }
  }
  if(ans)cout << "yes";
  else cout << "no";
}






Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}


int N;
int sums[201];
int tables[201][3];
int main(){

  cin>>N;
  for(int i=0;i<N;i++)
    for(int j=0;j<3;j++)
      cin>>tables[i][j];
  for(int i=0;i<3;i++){
    map<int,int> m;
    for(int j=0;j<N;j++)
      m[tables[j][i]]++;
    for(int j=0;j<N;j++){
      if(m[tables[j][i]]==1){
        sums[j]+=tables[j][i];
      }
    }
  }
  for(int i=0;i<N;i++)
    cout<<sums[i]<<endl;
  
  return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vull = vector<ull>;
#define rep(i, n) for (ull i = 0; i < n; ++i)
#define rep1(i, n) for (ull i = 1; i < n; ++i)
#define iter(it, v) for (auto it = v.begin(); it != v.end(); ++it)
#define pb push_back
#define fi first
#define se second
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}

vull factorization(ull n){
  vull v;
  ull MAX=sqrt(n)+1;
  for(ull i=2;i<MAX;++i) while(n%i==0) {
      v.pb(i);
      n/=i;
  }
  if(n!=1) v.pb(n);
  return v;
}

void solve() {
  // main coding
  ull a,b;
  cin>>a>>b;
  ull g=gcd(a,b);
  vull v=factorization(g);
  v.erase(unique(v.begin(),v.end()),v.end());
  cout<<v.size()+1<<endl;
}

int main() {
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
from collections import deque

N = int(input())
to = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    to[a - 1].append(b - 1)
    to[b - 1].append(a - 1)
dist = None
pars = [0] * N
q = deque()
q.append((0, 0, 0))
while len(q):
    a, d, p = q.pop()
    pars[a] = p
    if a == N - 1:
        dist = d
        break
    for b in to[a]:
        if b != p:
            q.append((b, d + 1, a))

boundw = N - 1
for _ in range((dist - 1) // 2):
    boundw = pars[boundw]

q = deque()
q.append((0, 1, 0))
ans = 0
while len(q):
    a, sgn, p = q.pop()
    if a == boundw:
        sgn = -1
    ans += sgn
    for b in to[a]:
        if b != p:
            q.append((b, sgn, a))
print("Fennec" if ans > 0 else "Snuke")


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

int main(){
	char s[101]={};
	cin>>s;
	int k=strlen(s);
	rep(i,k) cout<<'x';
	cout<<endl;
}

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

#define fastio {\
    ios::sync_with_stdio(0);\
    cin.tie(0);\
}

#define file {\
    freopen("io\\in.txt", "r", stdin);\
    freopen("io\\out.txt", "w", stdout);\
    freopen("io\\err.txt", "w", stderr);\
}

#ifdef LOCAL
#define debug(args...) {\
    string _s(#args);\
    replace(_s.begin(), _s.end(), ',', ' ');\
    stringstream _ss(_s);\
    istream_iterator<string> _it(_ss);\
    debug1(_it, args);\
}

#pragma GCC diagnostic ignored "-Wunused-parameter"
void debug1(istream_iterator<string> it) {
    cerr << endl;
}
#pragma GCC diagnostic pop

template<class T, class... Args>
void debug1(istream_iterator<string> it, T a, Args... args) {
    cerr << '>' << *it << " = " << a << "; ";
    debug1(++it, args...);
}
#else
#define debug(args...)
#define cerr if (false) cerr
#endif

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n)   for (int i = 0; i < n; i++)
#define dotc()      int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)       (int)x.size()
#define eb          emplace_back
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define all(x)      x.begin(), x.end()
#define rall(x)     x.rbegin(), x.rend()
#define fi          first
#define se          second

const int inf(0x3fffffff);
const int mod(1000000007);
const double pi(acos(-1.0));

signed main() {
    fastio;
#ifdef LOCAL
    file;
#endif

    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    ll ret = accumulate(a.begin() + n / 2, a.end(), 0ll);
    ret *= 2;
    ret -= a.back();
    if (n & 1) ret -= a[n / 2];
    cout << ret;

    return 0;
}


Measured memory_bytes: 3908
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

using i64 = long long;
#define forn(a, e) for (i64 a = 0; a < (i64)(e); a++)
#define forr(a, s, e) for (i64 a = s; a < (i64)(e); a++)
#define fore(e, a) for (auto& e : a)

#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif

using iip = pair<int, int>;
using llp = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;

template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }

template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }

template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
template<typename T, size_t N>
istream& operator>>(istream& is, array<T, N>& c) { for (auto& e : c) is >> e; return is; }

template<typename ...T>
istream& read(T&... args) { return (cin >> ... >> args); }

static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }

// const i64 INF = 1e18;
const int INF = 2e9;
const i64 M = 1e9 + 7;
const int MXB = 20;
using bin = bitset<MXB + 1>;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    rande.seed(chrono::steady_clock::now().time_since_epoch().count());

    int n;
    while (read(n)) {
        i64 ans = 0;
        for (i64 a = 1; a * a < n; a++) {
            i64 d1 = (n - 1) / a;
            i64 d2 = a;
            i64 d = 2 * max(0ll, d1 - d2) + 1;
            ans += d;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3688
#include <stdio.h>
 
#define  N    100
#define INF   100000
#define NIL   -1
#define WHITE 1
#define BLACK 0
 
int A[N][N];
int n;


void prim(void){

 int i, u, v, min;
 int ans = 0;
 int color[N], pi[N], d[N];
	
 for(u = 0; u < n; u++){
			d[u] = INF;
		 pi[u] = NIL;
	color[u] = WHITE;
 }
	
 d[0] = 0;

 while(1){

 min = INF;

 for(i = 0;i < n;i++){
	 if(color[i] != BLACK && d[i] < min){
	 min = d[i];
	 u = i;
	 }
	}
	 if(min == INF) break;
	 color[u] = BLACK;
	
 for(v = 0; v<n; v++){
	 if(color[v] != BLACK && A[u][v] < d[v] && A[u][v] != -1){
		pi[v] = u;
		d[v] = A[u][v];
	 }
	}
 }

 for(i=0; i < n;i++){
	ans += d[i];
	}

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



 
int main(){
 
  int i;
  int j;
   
  scanf("%d",&n);
 
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
  scanf("%d",&A[i][j]);
    }
  }
 
  prim();
 
  return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n+1,0);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if (a[a[i]] == i)
            ans++;
    }
    cout << ceil(ans / 2.0)<< endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int C[] = new int [N-1];//駅i+1にCi秒後に出発
    int S[] = new int [N-1];//開通式開始後Si秒後に駅iを発車
    int F[] = new int [N-1];//その後はFi秒おきに駅iを発車する
    
    for(int i=0; i<N-1; i++){
      C[i]=sc.nextInt();
      S[i]=sc.nextInt();
      F[i]=sc.nextInt();
    }
    
    for(int i=0; i<N-1; i++){
      int time = S[i] + C[i];
      for(int j=i+1; j<N-1; j++){
        
        if(S[j] > time){
          time = S[j];
        }
        
        if(time % F[j] != 0){
            time += F[j] -(time % F[j]);
        }
        time += C[j];
      }
      System.out.println(time);
    }
    System.out.println(0);
  }
}
    

Measured memory_bytes: 39588
/*
	Created by : imay_10
	" It won't be EASY, but I'll make it "
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

// Utility for fast exponentiation
ll mpow(ll a,ll b,ll m){
    ll res=1;
    //a%=m;
    while(b){
    	if(b%2) res=res*a%m;
		a=a*a%m;
		b/=2;
	}
	return res;
}

// Utility for GCD Calculation
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

void solve(){
	//code
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
		
	sort(a,a+n);
	cout<<a[n/2]-a[n/2-1];
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	solve();
 	return 0;
}


Measured memory_bytes: 4028
N,M = (int(i) for i in input().split())
a = [0] * M
mod = 1000000007
for i in range(M):
    a[i] = int(input())
a.append(100000000)
flag = 0
for i in range(M-1):
    if a[i] + 1 == a[i+1]:
        flag = 1
        break

dp = [1] * (N + 1)
tmp = 0

for i in range(N-1):
    if i+1 == a[tmp]:
        dp[i+2] = dp[i]
    elif i == a[tmp]:
        dp[i+2] = dp[i+1]
        tmp += 1
    else:
        dp[i+2] = (dp[i+1] + dp[i]) % mod

if flag == 1:
    print(0)
else:
    print(dp[N])


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

//create arrays outside of main()
int N = 10;
char a[3] = {};
char b[3] = {};

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

    int correct = 0;

    for(int i=0; i<3; i++){
        if(a[i] == b[i]){
            correct += 1;
        }
    }

    cout << correct;

    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {


    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        long n = in.nextLong();
        long k = in.nextLong();
        n = n % k;
        in.out.println(Math.min(Math.abs(n - k), n));
        in.out.close();
    }
}


class FastScanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    PrintWriter out;

    FastScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
    }

    FastScanner(String in, String out_) throws FileNotFoundException {
        br = new BufferedReader(new FileReader(in));
        out = new PrintWriter(out_);
    }

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

Measured memory_bytes: 21204
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n;
    cin >> n;
    for (int i = 1; i <= 9; i++)
        for (int j = 1; j <= 9; j++)
        {
            if (i * j == n)
            {
                print("Yes");
                return;
            }
        }
    print("No");
}

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

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  x,y=LI()
  ans=0

  if x==3:
    ans+=100000
  elif x==2:
    ans+=200000
  elif x==1:
    ans+=300000
  if y==3:
    ans+=100000
  elif y==2:
    ans+=200000
  elif y==1:
    ans+=300000
  if x==1 and y==1:
    ans+=400000
  return ans

# main()
print(main())


Measured memory_bytes: 7844
#include <iostream>
#include <list>
#include <string>

int N, L;

int main()
{
	std::list<std::string> list;

	scanf("%d %d", &N, &L);
	for (int i = 0; i < N; ++i)
	{
		std::string str;
		std::cin >> str;

		list.push_back(str);
	}

	list.sort();
	
	std::string ans = "";
	for (auto itr = list.begin(); itr != list.end(); itr++)
	{
		ans = ans + (*itr);
	}

	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new AOJ0539().doIt();
	}

	class AOJ0539{
		long d,n,m;
		ArrayList<Long> list;
		void doIt(){
			while(in.hasNext()){
				d = in.nextLong();if(d==0)break;
				n = in.nextLong();
				m = in.nextLong();
				list = new ArrayList<Long>();
				list.add(0L);
				for(int i=0;i<n-1;i++)list.add(in.nextLong());
				list.add(d);
				Collections.sort(list);
				//			System.out.println(list);
				long result = 0;
				for(int i=0;i<m;i++){
					long b = in.nextLong();
					//				System.out.println(b);
					int q = Collections.binarySearch(list, b);
					if(q<0){
						q = ~q;
						long min = Math.min(Math.abs(list.get(q)-b), Math.abs(list.get(q-1)-b));
						result += min;
					}
					//				System.out.println();
				}
				System.out.println(result);
			}
		}
	}

}

Measured memory_bytes: 82864
//It is made by wfj_2048~
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define inf (1<<30)
#define il inline
#define RG register
#define ll long long

using namespace std;

int r,g,b;

il int gi(){
    RG int x=0,q=1; RG char ch=getchar(); while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
    if (ch=='-') q=-1,ch=getchar(); while (ch>='0' && ch<='9') x=x*10+ch-48,ch=getchar(); return q*x;
}

il void work(){
    r=gi(),g=gi(),b=gi();
    if ((g*10+b)%4==0) puts("YES");
    else puts("NO"); return;
}

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


Measured memory_bytes: 256
//
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define speed ios::sync_with_stdio(false)
using namespace std;

string gs(char x){
    string s(1,x);
    return s;
}

int main()
{
	speed;
	
	ll n;
	cin>>n;

	ll ans=0;

	ll a,b;
	for(ll i=0;i<n;i++)
	{
		cin>>a;
		while(1)
		{
			b=a%2;
			if(b==0)
			{
				a/=2;
				ans++;
			}
			else
			{
				break;
			}
		}
	}
	cout<<ans;

	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include<unordered_map>
#define ll long long
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
int main()
{
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    for(int i=1;;i++){
        c-=b;
        if(c<=0){
            cout<<"Yes";
            break;
        }
        a-=d;
        if(a<=0){
            cout<<"No";
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3140
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n, D[101000];
vector<int>E[101000];
void DFS(int a, int p){
    int i;
    for(i=0;i<E[a].size();i++){
        if(E[a][i]==p)continue;
        DFS(E[a][i], a);
        D[a] ^= (D[E[a][i]] + 1);
    }
}
int main(){
    int i, a, b;
    scanf("%d",&n);
    for(i=1;i<n;i++){
        scanf("%d%d",&a,&b);
        E[a].push_back(b);
        E[b].push_back(a);
    }
    DFS(1, 0);
    printf(D[1] ? "Alice\n" : "Bob\n");
}

Measured memory_bytes: 12416
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> x ;

  k=100;
  for(ll i=0;i<9000000;i++){
    if (k>=x){
      ans=i;
      break;
    }
    k=k+k/100;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int bd[100010];
	for(int i=0;i<n;i++) 
		cin >> bd[i];
	int f=1;	
	
	if(n==1) {cout << "Yes";	return 0;
	}
	else{
		bd[0]--;
		for(int i=1;i<n;i++){
			if(bd[i]>bd[i-1]) bd[i]--;
			else if(bd[i]<bd[i-1]){
				f=0;
				break;
			}
		} 
	}
	if(f) cout << "Yes";
	else cout << "No";
	return 0;
	
}

Measured memory_bytes: 640
n = int(input())
s = input()

r,g,b = 0,0,0
for k in range(n):
    if s[k] == "R":
        r += 1
    elif s[k] == "G":
        g += 1
    elif s[k] == "B":
        b += 1
# print(r,g,b,s)
d = 0

for p in range(0,n-2):
    q = 1 
    while p+2*q<=n-1:
        if s[p] != s[p+q] and s[p] != s[p+2*q] and s[p+q] != s[p+2*q]:
            d+=1
            # print(s[p],s[p+q],s[p+2*q])
            q += 1
            
            # print(q)
        else:
            # print(q)
            q = q+1

print(r*g*b-d)

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int K;
    cin>>K;
    vector<int>a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    
    cout<<a.at(K-1)<<endl;
    return 0;
}

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

int main() {

    int N,K;    //すぬけ君の人数N お菓子の種類K
    cin >> N >> K;
    int d;  //お菓子iを持っている人数
    vector<int> A(N);       //お菓子iを持っているすぬけ君x
    vector<int> ocnt(N);    //すぬけ君xの持っているお菓子の数
    int cnt = 0;
    int ans = 0;

    while (cnt < K){
        cin >> d;

        for (int i=0; i<d; i++){
            cin >> A.at(i);
        }
        for (int i=0; i<d; i++){
            ocnt.at(A.at(i)-1) += 1;
        }
            cnt++;
    }

    for (int i=0; i<N; i++){
        if(ocnt.at(i) == 0){
            ans++;
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 3624
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()
abc = [LIST() for _ in range(M)]
# ワーシャルフロイド法
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

d = [[INF for i in range(N)] for i in range(N)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for x, y, z in abc:
    d[x-1][y-1] = z
    d[y-1][x-1] = z
for i in range(N):
    d[i][i] = 0 #自身のところに行くコストは０
warshall_floyd(d)
count = 0
for a, b, c in abc:
	for i in range(N):
		if d[i][a-1] + c == d[a-1][b-1]:
			break
	else:
		count += 1
print(count)

Measured memory_bytes: 4192
#include "bits/stdc++.h"

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;
unsigned long long str_to_int(std::string str) {
	unsigned long long ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	int mini = 1e9, maxi = -1,G;
	rep(i, n) {
		cin >> v[i];
		mini = min(mini, v[i]);
		maxi = max(maxi, v[i]);
	}
	G = mini;
	rep(i, n) {
		G = gcd(v[i], G);
	}
	if (k % G == 0 and maxi >= k) {
		P("POSSIBLE");
	}
	else {
		P("IMPOSSIBLE");
	}
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = Integer.parseInt(s.next());
		int b = Integer.parseInt(s.next());
		int c = Integer.parseInt(s.next());

		if(a < b && b < c){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 26040
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define pb push_back
#define lp(j, n)  for(int j=0; j<(int)(n); ++j)
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define sz(v)    ( (int)((v).size()) )
#define F first
#define S second
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int,int> > vpii;
typedef map<int, int> mii;
const ll N=1e5+5;
ll arr[N],A[N]  ;
bool visited[N]={};
int main()
{

  int n,m,c,count(0);
  vi v;
  cin>>n>>m>>c;
  for(int i=1 ; i<=100 ; i++)
  {
          if(n%i==0 && m%i==0)
          {
              v.pb(i);
          }
  }
  sort(v.rbegin(),v.rend());
  cout<<v[c-1];
 go;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> s(H+2, vector<char>(W+2));
   vector<vector<int>> c(H+2, vector<int>(W+2));
  for (int i=0;i<H+2;i++){
    for (int j=1;j<W+2;j++){
      s.at(i).at(j)='.';
    }
  }
  
  for (int i=1;i<H+1;i++){
    for (int j=1;j<W+1;j++){
      cin >> s.at(i).at(j);
    }
  }
  
  for (int i=1;i<H+1;i++){
    for (int j=1;j<W+1;j++){
      int bomb=0;
      if (s.at(i).at(j)=='.'){
      	for (int k=-1;k<2;k++){
          for (int l=-1;l<2;l++){
            if (k!=0 || l!=0){
              if (s.at(i+k).at(j+l)=='#') bomb++;
            }
          }
        }
      }
      c.at(i).at(j)=bomb;
    	
    }
  }
  
  for (int i=1;i<H+1;i++){
    for (int j=1;j<W+1;j++){
      if (s.at(i).at(j)=='.') cout << c.at(i).at(j);
      else cout << '#';
    }
    cout << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

int main() {
	ll l, r;
	cin >> l >> r;
	if (r - l >= 2019) {
		cout << 0;
		return 0;
	}
	ll m = 2019 * 2019;
	reps(i, l, r) {
		reps(j, i + 1, r + 1) {
			if (m > i * j % 2019) m = i * j % 2019;
		}
	}
	cout << m;
	return 0;
}

Measured memory_bytes: 256
N,M,C = map(int, input().split())
B = list(map(int, input().split()))

ans = 0

for i in range(N):
    A = list(map(int, input().split()))
    check = C

    for i,j in zip(A,B):
        check = check + (i*j)

    if check > 0:
        ans = ans + 1

print(ans)

Measured memory_bytes: 3060
local r_shift = bit.rshift
local b_and = bit.band

local N = io.read("*n", "*l")
local X = io.read("*l")
local b_0 = string.byte("0")
local X_s = {}
local popcountX = 0
for i = 1, N do
	local byte = X:byte(i)
	if byte == b_0 then
		X_s[i] = 0
	else
		popcountX = popcountX + 1
		X_s[i] = 1
	end
end

local popcountXPlus1, popcountXMinus1 = popcountX + 1, popcountX - 1

local pow2ModPopcountXPlus1 = {}
pow2ModPopcountXPlus1[1] = 1
for i = 2, N do --ここ謎
	pow2ModPopcountXPlus1[i] = (pow2ModPopcountXPlus1[i-1] * 2) % popcountXPlus1
end
local pow2ModPopcountXMinus1 = {}
pow2ModPopcountXMinus1[1] = 1
if popcountXMinus1 > 0 then
	for i = 2, N do
		pow2ModPopcountXMinus1[i] = (pow2ModPopcountXMinus1[i-1] * 2) % popcountXMinus1
	end
end

local xModPopcountXPlus1 = 0
for digit = 1, N do
	local pos = N + 1 - digit
	if X_s[pos] == 1 then
		xModPopcountXPlus1 = xModPopcountXPlus1 + pow2ModPopcountXPlus1[digit]
		xModPopcountXPlus1 = xModPopcountXPlus1 % popcountXPlus1
	end
end
local xModPopcountXMinus1 = 0
if popcountXMinus1 > 0 then
	for digit = 1, N do
		local pos = N + 1 - digit
		if X_s[pos] == 1 then
			xModPopcountXMinus1 = xModPopcountXMinus1 + pow2ModPopcountXMinus1[digit]
			xModPopcountXMinus1 = xModPopcountXMinus1 + popcountXMinus1
		end
	end
end

local function popcount(num)
	local count = 0
	while num > 0 do
		if b_and(num, 1) == 1 then
			count = count + 1
		end
		num = r_shift(num, 1)
	end
	return count
end

local f = {}
local function getF(num)
	if num == 0 then
		return 0
	end
	if f[num] and f[num] > 0 then
		return f[num]
	end
	local ans = 1 + getF(num % popcount(num))
	f[num] = ans
	return ans
end

for pos = 1, N do
	local digit = N + 1 - pos

	local modXi = 0
	if X_s[pos] == 0 then
		modXi = xModPopcountXPlus1 + pow2ModPopcountXPlus1[digit]
		modXi = modXi % popcountXPlus1
		local ans = 1 + getF(modXi)
		print(ans)
	elseif popcountXMinus1 > 0 then
		modXi = xModPopcountXMinus1 + (popcountXMinus1 - pow2ModPopcountXMinus1[digit])
		modXi = modXi % popcountXMinus1
		local ans = 1 + getF(modXi)
		print(ans)
	else
		print(0)
	end
end


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

using namespace std;

template<typename T>void read(T&x){x=0;int fl=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')
fl=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}x*=fl;}
template<typename T,typename...Args>inline void read(T&t,Args&...args){read(t);read(args...);}

typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define mp(x, y) make_pair(x, y)
#define pb(x) emplace_back(x)

const int N = 2005;

int n;
struct Node{
	LL val;
	int pos;
	bool operator < (const Node &A) const{
		return val > A.val;
	}
}a[N];
LL dp[N][N], ans;

int main(){
	read(n);
	for(int i = 1; i <= n; i++)
		read(a[i].val), a[i].pos = i;
	sort(a+1, a+n+1);
	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= i; j++){
			if(j)	dp[i][j] = max(dp[i][j], dp[i-1][j-1] + abs(j - a[i].pos) * a[i].val);
			if(j != i)	dp[i][j] = max(dp[i][j], dp[i-1][j] + abs(n-i+j+1 - a[i].pos) * a[i].val);
			if(i == n)	ans = max(ans, dp[n][j]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 26440
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
string s;
int main(){
    cin>>s;
	int k=s.size();
    if(k%2!=0){
        printf("No");
        return 0;
	}
    for(int i=0;i<k/2;i++){
        if(s[i]=='b'&&s[k-i-1]!='d'){
            printf("No");
            return 0;
        }
        if(s[i]=='d'&&s[k-i-1]!='b'){
            printf("No");
            return 0;
        }
        if(s[i]=='q'&&s[k-i-1]!='p'){
            printf("No");
            return 0;
        }
        if(s[i]=='p'&&s[k-i-1]!='q'){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 512
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;
int a[]={0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
//	freopen("std.in","r",stdin);
	cout<<a[read()]<<endl;
	return 0;
}


Measured memory_bytes: 256
/*
  In the name of ALLAH
  Author : Raashid Anwar
*/

#include <bits/stdc++.h>
using namespace std;
 
#define int int64_t
const int M1 =  998244353;
const int M2 =  1000000007;
mt19937 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());


void solve() {
  int n, x, t;
  cin >> n >> x >> t;
  cout << ((n + x - 1) / x) * t << "\n";
}
 
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}

Measured memory_bytes: 3632
import sys
input = sys.stdin.readline

def main():
  n,m = map(int, input().split())
  heights = tuple(map(int, input().split()))

  roads = [tuple(map(int, input().split())) for _ in range(m)]
  max_heights = [0 for _ in range(n)]

  for i in range(m):
    build_1 = roads[i][0]-1
    build_2 = roads[i][1]-1
    if heights[build_2] > max_heights[build_1]:
      max_heights[build_1] = heights[build_2]
    if heights[build_1] > max_heights[build_2]:
      max_heights[build_2] = heights[build_1]

  sum = 0
  for i in range(n):
    if heights[i] > max_heights[i]:
      sum += 1
  print(sum)

if __name__ == '__main__':
  main()

Measured memory_bytes: 27148
#include<iostream>
using namespace std;
int main()
{
  char s[4],t[4];
  cin >> s >> t;
  int cnt = 0;
  for(int i = 0;s[i] != '\0';i++)
    if(s[i] == t[i])cnt++;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256