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

using namespace std;
typedef long long ll;
#define watch(x) cout << "["<<(#x) << " is " << (x) << "]" << endl

double choose(double n, double r){
	double top,second,third;
	if(r==0){
		return 1.0;
	}
	else{
		 top = 1.0;
		for(double x = 1; x <= n; ++x){
			top *= x;
		}
		 second= 1.0;
		for(double x = 1; x <= r; ++x){
			second *= x;
		}
		 third=1.0;
		for(double x = 1; x <= (n-r); ++x){
			third *= x;
		}
	}
	return (top/((second*third)));
}


void solve(){
	int x;
	cin >> x;
	if(x>=30){
		cout <<"Yes" <<endl;
	}
	else{
		cout << "No" << endl;
	}
}

int main(){
	// cout << choose(15,4) << endl;
	//freopen("input.txt", "r", stdin);
	solve();
	return 0;

}

Measured memory_bytes: 3600
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const int maxn = 2e5+5;
const int ff = 0x3f3f3f3f;

/*int main()
{
	int n;
	cin>>n;
	int flag = 0;
	while(n)
	{
		if(n%10 == 9)
		{
			flag = 1;
			break;
		}
		n/= 10;
	}
	if(flag)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	
	
	return 0;
}*/

int main()
{
	int t;
	int ans = 0;
	cin>>t;
	while(t--)
	{
		int l,r;
		cin>>l>>r;
		ans+= (r-l+1);
	}
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
vector<int> G[200010];
vector<int> ans(200010);

void dfs(int u, int p = -1) {
    for (int v: G[u]) {
        if (v == p) continue;
        ans[v] += ans[u];
        dfs(v, u);
    }
}

int main() {
    int N, Q; cin >> N >> Q;
    for (int i = 0; i < N - 1; i++) {
        int a, b; cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }
    for (int i = 0; i < Q; i++) {
        int p, x; cin >> p >> x;
        ans[p-1] += x;
    }
    dfs(0);
    for (int i = 0; i < N; i++) {
        if (i) cout << " "; 
        cout << ans[i];
    }
}

Measured memory_bytes: 23424
import math

abc = [int(input()) for _ in range(5)]

s = 0
t = 0

for a in abc:
    s += math.ceil(a / 10)
    if a % 10 != 0:
        t = max(t, 10 - a % 10)
        
if t != 0:
    print(s * 10 - t)
else:
    print(s * 10)


Measured memory_bytes: 9212
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")



int main() {
    ll n,m,d; cin >> n >> m;
    bool flag = true;
    vector<string> a(n),b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    d = n-m+1;

    rep(i,d){
        rep(j,d){
            flag = true;
            rep(k,m){
                rep(l,m){
                    if(b[k][l] != a[k+i][l+j]) flag = false;
                }
            }
            if(flag){
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 3596
N = int(input())
LRs = []
for i in range(N):
    L, R = map(int, input().split())
    LRs += [(L, R, i)]

Ls = sorted(LRs)
Rs = sorted(LRs, key=lambda x: x[1])


# 1手目がマイナス方向の場合
done = [False] * N
iL = N - 1
iR = 0
ans1 = 0
xNow = 0
while True:
    # マイナス方向に移動
    while iR < N and done[Rs[iR][2]]: iR += 1
    if iR == N: break

    xNext = Rs[iR][1]
    if xNow < xNext: break

    ans1 += xNow - xNext
    xNow = xNext
    done[Rs[iR][2]] = True

    # プラス方向に移動
    while iL >= 0 and done[Ls[iL][2]]: iL -= 1
    if iL < 0: break

    xNext = Ls[iL][0]
    if xNext < xNow: break

    ans1 += xNext - xNow
    xNow = xNext
    done[Ls[iL][2]] = True

ans1 += abs(xNow)


# 1手目がプラス方向の場合
done = [False] * N
iL = N - 1
iR = 0
ans2 = 0
xNow = 0
while True:
    # プラス方向に移動
    while iL >= 0 and done[Ls[iL][2]]: iL -= 1
    if iL < 0: break

    xNext = Ls[iL][0]
    if xNext < xNow: break

    ans2 += xNext - xNow
    xNow = xNext
    done[Ls[iL][2]] = True

    # マイナス方向に移動
    while iR < N and done[Rs[iR][2]]: iR += 1
    if iR == N: break

    xNext = Rs[iR][1]
    if xNow < xNext: break

    ans2 += xNow - xNext
    xNow = xNext
    done[Rs[iR][2]] = True

ans2 += abs(xNow)

print(max(ans1, ans2))


Measured memory_bytes: 25612
#include<iostream>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define rrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

template<typename T>
T ModPow(T s, T n)
{
    T res = 1;

    while(n) {
        if (n & 1) { 
            res *= s;
            res %= MOD;
        }
        s *= s;
        s %= MOD;
        n >>= 1;
    }
    return res;
}

template<typename T>
T ModInv(T n) {
    return ModPow(n, MOD - 2);
}

template<typename T>
T ModnCr(T n, T r) 
{
    T x = 1, y = 1;
    
    rep(i, r) {
        x *= n-i;
        x %= MOD;

        y *= r-i;
        y %= MOD;
    }

    T rtn = (x * ModInv(y)) % MOD;
    return rtn;
}

ll func(ll n) 
{
    ll res = 1;
    while(n) {
        res *= n;
        res %= MOD;
        n--;
    }
    return res;
}

int main(void)
{
    int x,y;
    cin >> x >> y;

    int d = 2 * x - y;
    if(d%3 != 0) {
        cout << 0 << endl; 
    } else {
        ll a = x - (2 * d) / 3;
        ll b = d / 3;
        if(a < 0 || b < 0) { cout << 0 << endl; return 0; }
        ll ans = ModnCr(a+b,b);
        cout << ans << endl;
    }
    return 0;
} /*atcoder*/



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

using namespace std;
using ll = long long int;
#define long ll

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

    ll n;
    cin >> n;
    bitset<8> s;
    ll m = 0;
    for(ll i=0; i<n; i++) {
        ll a;
        cin >> a;
        if(3200 <= a)
            m++;
        else if(2800 <= a)
            s[0]=1;
        else if(2400 <= a)
            s[1]=1;
        else if(2000 <= a)
            s[2]=1;
        else if(1600 <= a)
            s[3]=1;
        else if(1200 <= a)
            s[4]=1;
        else if(800 <= a)
            s[5]=1;
        else if(400 <= a)
            s[6]=1;
        else if(1 <= a)
            s[7]=1;
    }

    ll mi = min(max(1ll, (ll)s.count()), 8ll);
    ll ma = min(max(1ll, (ll)s.count()+m),  (ll)1e9);
    cout << mi << ' ' << ma << endl;
}


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

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#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 UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

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

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) &= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
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();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int A, B;
  cin >> A >> B;
  int ans = 0;
  if (A > B) {
    ans += A;
    A--;
  } else {
    ans += B;
    B--;
  }

  if (A > B) {
    ans += A;
    A--;
  } else {
    ans += B;
    B--;
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[200000];
int n, k;
bool check(ll x){
    int count = 0;
    for(int i = 0; i < n; i++){
        if(a[i] > x){
            count += (a[i]/x + (a[i]%x !=0))-1;
        }
    }
    return count <= k;
}
int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    if (fopen("input.in", "r")) {
        freopen("input.in", "r", stdin);
        freopen("output.out", "w", stdout);
    }
    cin>>n>>k;
    for(int i = 0; i< n; i++) cin>>a[i];
    ll l = 0;
    ll r = 1e9 +1;
    while(l +1 < r){
        ll mid = (l+r)/2;
        if(check(mid)) r = mid;
        else l = mid;
    }
    cout<<r<<"\n";

}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



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

    vector<pair<ll,ll>> v(n);
    REP(i, n){
        cin >> v[i].first >> v[i].second;
    }

    sort(all(v));

    int p = 0;
    ll ans = 0;
    priority_queue<int, vector<int>, less<int>> que;

    FOR(i, 1, m+1){        
        while(p < n && v[p].first <= i){
            que.push(v[p].second);
            p++;
        }
        
        if(!que.empty()){
            ans += (ll) que.top();
            que.pop();
        }
    }

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


Measured memory_bytes: 2428
n, m = map(int, input().split())
pn = list(map(lambda x:int(x)-1, input().split()))
ls = [-1] * n
for i in pn:
    ls[pn[i]] = i
#print(ls)

par = [i for i in range(n)]

def find(x):
    if par[x] == x:
        return x
    else:
        s = find(par[x])
        par[x] = s
        return s

def unite(x,y):
    s = find(x)
    t = find(y)
    if s>t:
        par[s] = t
    else:
        par[t] = s


for _ in range(m):
    x, y = map(lambda x:int(x)-1, input().split())
    unite(ls[x],ls[y])

ans2 = 0
for i in range(n): 
    place1 = i
    place2 = ls[i]

    if find(place1)==find(place2):
       ans2+=1
print(ans2)

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

int main() {
  int N;
  cin >> N;
  int x, a = 0, b = 0, c = 0;
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (x % 4 == 0)
      a++;
    else if (x % 2 == 0)
      b++;
    else
      c++;
  }

  if (b >= 1) c++;
  if ((a >= 1 && a + 1 >= c) || (b == N && N >= 2))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <limits.h>
#include <vector>
#include <map>
#include <string>
#include <tuple>
#include <math.h>
using namespace std;
typedef long long ll;

int main(void){
    ll n, k;
    cin >> n >> k;
    
    if (k == 0) {
        cout << n * n << endl;
        return 0;
    } 
    
    ll ans = 0;
    for (int i = k + 1; i <= n; i++) {
        ll j = i - n % i;
        if (j <= i - k) {
            ans += (j - 1) * ((n + 1) / i) + (i - k - j + 1) * ((n + i - k) / i);
        }
        else ans += (i - k) * ((n + 1) / i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;

class DPredictionAndRestriction {
 public:
  void solve(std::istream &in, std::ostream &out) {
    int N, k;
    string T;
    in >> N >> k;

    vector<int> p(3);
    forn(i, 3)in >> p[i];

    in >> T;

    int ans = 0;

    forn(a, k) {

      string t;
      for (int i = a; i < N; i += k)t += T[i];
      int n = t.size();

      vector<int> dp(3, 0);

      forn(i, n) {
        int w = -1;
        if (t[i] == 's')w = 0;
        else if (t[i] == 'p') w = 1;
        else if (t[i] == 'r')w = 2;

        vector<int> best(3, 0);

        forn(j, 3)
          forn(k, 3) if (j != k) {
              if (k == w)
                best[k] = max(best[k], dp[j] + p[k]);
              else
                best[k] = max(best[k], dp[j]);
            }
        dp = best;
      }
      ans += *max_element(all(dp));
    }
    out << ans << endl;
  }

};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  DPredictionAndRestriction solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main(){
    char a,b,c;
    int m[3]={0,1,2};
    while(cin>>a>>b>>c){
        swap(m[a-'A'],m[c-'A']);
    }
    for(int i=0;i<3;i++){
        if(m[i]==0){cout<<char('A'+i)<<endl;return 0;}
    }
}

Measured memory_bytes: 1132
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long LL;

int main(int argc, char* argv[]) {
	LL n, k;
	cin >> n >> k;
	vector<int> a(n), p(n, -1);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		--a[i];
	}
	int c = 0;
	for (LL t = 0; t < k; ++t) {
		c = a[c];
		if (p[c] >= 0) {
			LL f = t - p[c];
			LL x = (k - t - 2 * f) / f;
			if (x > 0) {
				t += x * f;
			}
		}
		p[c] = t;
	}
	cout << (c + 1) << endl;
	return 0;
}


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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

constexpr int MOD = 1000000007;

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

    int a, b;
    cin >> a >> b;
    
    int n = min(a, b);
    int m = max(a, b);

    rep(i, 0, m) {
        cout << n;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
// Problem : C - Skill Up
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 

// int ind[N];
int solve(){


	int n,m,x;cin>>n>>m>>x;
	int c[n];
	int a[n][m];
	int sum[m];
	memset(sum,0,sizeof(sum));
	rep0(n){
		cin>>c[i];
		repi(j,0,m) cin>>a[i][j];
		repi(j,0,m) sum[j]+=a[i][j];
	}
	rep0(m) if(sum[i]<x) return cout<<-1,0;
	int cost=1e18;
	for(int mask=1;mask<(1<<n);mask++){
		int sum[n];
		int cs=0;
		memset(sum,0,sizeof(sum));
		for(int i=0;i<n;i++){
			if(mask&(1<<i)){
				cs+=c[i];
				for(int j=0;j<m;j++){
					sum[j]+=a[i][j];
				}
			}
		}
		bool z=0;
		for(int i=0;i<m;i++) if(sum[i]<x) z=1;
		if(!z) amin(cost,cs);
	}	
	cout<<cost;

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


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

int main(){
	
		int t[31] = { 0 };
		int n;
		for (int i = 0; i < 28; i++){
			cin >> n;
			t[n] =  1 ;
		}
		
		for (int i = 1; i<31; i++){
			if  ( t[i] == 0 ){
				cout << i << endl;
			}
		}
	}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
int main() {
	std::cin.tie(0); std::cin.sync_with_stdio(false);
	long long int n; std::cin >> n;
	long long int last = 1;
	for (long long int a = 2; a * a <= n; ++a) {
		if (n % a == 0) last = a;
	}
	std::cout << last + n / last - 2 << '\n';
}


Measured memory_bytes: 888
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

#define MAX 100000

using namespace std;

typedef long long ll;

int main(){
  int n; cin >> n;
  int cnt[MAX+1];
  for(int i=1;i<=MAX;i++) cnt[i]=0;
  for(int i=0;i<n;i++){
    int x; cin >> x;
    cnt[x]++;
  }
  int u=0,even=0;
  for(int i=1;i<=MAX;i++){
    if(cnt[i] == 0) continue;
    u++;
    if(cnt[i] % 2 == 0){
      even++;
    }
  }
  if(even % 2 == 0){
    cout << u << endl;
  }else{
    cout << u-1 << endl;
  }
}

Measured memory_bytes: 640
import java.util.*;
 
public class Main {
 
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    final int N = sc.nextInt();
    int[] a = new int[N];
    for(int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    int[] x = new int[1000001];
    for(int i=0;i<N;i++){
      if(x[a[i]] >= 1){
        x[a[i]]++;
        continue;
      }
      for(int j = 1; a[i] * j <= 1000000;j++){
     	x[a[i] * j]++;  //1つ存在すれば1 2つ以上存在すれば2以上なので解に含めない　
      }
    }
    int count = 0;
    for(int i=0;i<N;i++){
      if(x[a[i]] == 1){
        count++;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 50480
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define sz(v) (int)v.size()
#define pb push_back

using namespace std;
string n;
int main(){
    cin >> n;
    int f = 0;
    rep(i,sz(n)) f+=n[i]-'0';
    cout << ((stoi(n)%f)? "No" : "Yes") << endl;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            int maxLength = Max(a.Length, b.Length);
            a = a.PadLeft(maxLength, '0');
            b = b.PadLeft(maxLength, '0');

            int comp = a.CompareTo(b);
            if (comp < 0)
            {
                Console.WriteLine("LESS");
            }
            else if (comp == 0)
            {
                Console.WriteLine("EQUAL");
            }
            else
            {
                Console.WriteLine("GREATER");
            }
        }
    }
}

Measured memory_bytes: 13524
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            int k = (y - i * 10000 - j * 5000) / 1000;
            if (i + j + k == n && k >= 0) {
                cout << i << ' ' << j << ' ' << k << endl;
                quick_exit(0);
            }
        }
    }

    cout << "-1 -1 -1" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n,d,x,sum,a;
int main()
{
    cin>>n>>d>>x;
    while(n--)
    {
        scanf("%d",&a);
        for(int i=1;i<=d;i+=a)
            sum++;
    }
    printf("%d\n",sum+x);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
	long long v,a,b,x;
	cin>>a>>b>>x;
	long z=b/x-(a-1)/x;
	if(a==0){
		v=b/x+1;	
		cout<<v<<endl;
	}
	else {
	cout<<z<<endl;}
	return 0;
}

Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N = I()
    A = LI()
    a_max = A[0]
    ans = 0
    for i in range(1,len(A)):
        if A[i]<a_max:
            ans += a_max-A[i]
        else:
            a_max = A[i]
    print(ans)

main()



Measured memory_bytes: 50868
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率

def input(): return sys.stdin.readline()[:-1]
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    A, V = map(int, input().split())
    B,W=map(int, input().split())
    T=int(input())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列


    if A==B:
        print("YES")
        return
    
    if B>A:
        if B+W*T<=A+V*T:
            print('YES')
            return 
        print('NO')
    
    else:
        if B-W*T>=A-V*T:
            print('YES')
            return 
        print('NO')




if __name__ == "__main__":
    main()

Measured memory_bytes: 68040
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;
int n, k;
int a[nax], y;

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

    for (int i = 1 ; i <= n; ++ i) {
        scanf("%d", &a[i]);
        y = max(y, a[i] - a[i - 1]);
    }

    y = max(y, k + a[1] - a[n]);

    printf("%d\n", k - y);
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <numeric>
#include <cmath>


#define rep(i, n) for(int i = 0;i < (int)(n); i++)
#define pb push_back
typedef long long ll;

using namespace std;


int main() {
    string s;
    cin >> s;
    int a,b,c,d;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';

    s += "=7";
    //a?b?c?d=7
    s.insert(1,"?");
    s.insert(3,"?");
    s.insert(5,"?");
    rep(i, 8){
        int sum = 0;
        string ans = s;
        sum += a;
        if(i & 1) {
            sum += b;
            ans[1] = '+';
        }else{
            sum -=b;
            ans[1] = '-';
        }
        if(i & 2) {
            sum += c;
            ans[3] = '+';
        }else{
            sum -= c;
            ans[3] = '-';
        }
        if(i & 4) {
            sum += d;
            ans[5] = '+';
        }else {
            sum -= d;
            ans[5] = '-';
        }
        if(sum == 7){
            cout << ans << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const long long mod = 1000000007;
const int maxn = 100100;
vector<int> tr[maxn];
int a[maxn], b[maxn], c[maxn], sz[maxn];
long long s[maxn], dw[maxn], res[maxn];
int nsz[maxn], par[maxn];
void in(int cur){
    nsz[cur] = 1;
    for(int id : tr[cur]){
        int nxt = cur ^ c[id];
        if(nxt == par[cur]) continue;
        par[nxt] = cur;
        in(nxt);
        nsz[cur] += nsz[nxt];
    }
}
int n;
void solve(int cur, int pr = -1){
    sz[cur] = 1;
    dw[cur] = 0;
    for(int id : tr[cur]){
        int nxt = cur ^ c[id];
        if(nxt == pr) continue;
        solve(nxt, cur);
        sz[cur] += sz[nxt];
    }
    for(int id : tr[cur]){
        int nxt = cur ^ c[id];
        if(nxt == pr) continue;
        int den = ((n - sz[nxt] + 1) - 1 - sz[nxt]);
        if(den == 0){
            res[id] = (s[cur] - dw[nxt]) / (sz[nxt]);
        } else {
            res[id] = (s[nxt] - s[cur]) / den;
        }
        dw[cur] += dw[nxt] + (sz[nxt]) * res[id];
    }
}
int main(){
    scanf("%d", &n);
    for(int e = 0; e < n - 1; e++){
        scanf("%d %d", a + e, b + e); c[e] = a[e] ^ b[e];
        tr[a[e]].push_back(e);
        tr[b[e]].push_back(e);
    }
    for(int e = 1; e <= n; e++) scanf("%lld", s + e);
    in(1);
    vector<int> bad_edge;
    for(int e = 0; e < n - 1; e++){
        if(par[a[e]] == b[e]){
            if(n - nsz[a[e]] == nsz[a[e]]) bad_edge.push_back(e);
        } else {
            if(n - nsz[b[e]] == nsz[b[e]]) bad_edge.push_back(e);
        }
    }
    if(bad_edge.size()){
        assert(bad_edge.size() == 1);
        int u = a[bad_edge[0]], v = b[bad_edge[0]];
        solve(u, v);
        solve(v, u);
        long long s0 = s[u] - dw[u] - dw[v];
        long long s1 = s[v] - dw[u] - dw[v];
        res[bad_edge[0]] = (s0 / sz[v]);
    } else
        solve(1);

    for(int e = 0; e < n - 1; e++) cout << res[e] << endl;
	return 0;
}


Measured memory_bytes: 18816
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>

using namespace std;

int main(void) {
	int a,b,c,n,k,t;
	string s;

	cin>>a>>b>>t;


	cout<<b*int((t+0.5)/a)<<"\n";

	return 0;
}


Measured memory_bytes: 256
n = int(input())
t = [int(input()) for i in range(n)]
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

res = t[0]
for i in range(1,n):
    res = lcm(res, t[i])

print(res)



Measured memory_bytes: 3060
S = input()
T = input()

len_diff = len(S) - len(T)

min_diff = len(S)

for i in range(len_diff + 1):
    s = S[i:i+len(T)]
    diff = 0
    for j in range(len(T)):
        if s[j] != T[j]:
            diff += 1
    min_diff = min(min_diff, diff)
    
print(min_diff)

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

using namespace std;
using lint = long long;

int arr[50][4] = {0};
int Q;

int dfs(vector<int> A, int digit, int max, int N, int M)
{
    if(N < digit){
        int sum = 0;
        for(int i = 0; i <= Q; i++){
            if(A[arr[i][1]] - A[arr[i][0]] == arr[i][2]){
                sum += arr[i][3];
            }
        }

        return sum;
    }
    for(int i = A[digit-1]; i < M; i++){
        A[digit] = i;
        int x = dfs(A, digit+1, max, N, M);
        if(x > max){
            max = x;
        }
    }
    return max;
}

int main(void)
{
    int N, M;
    cin >> N >> M >> Q;

    for(int i = 0; i < Q; i++){
        cin >> arr[i][0] >> arr[i][1] >> arr[i][2] >> arr[i][3];
    }
    vector<int> A(N+1, 0);
    cout << dfs(A, 1, 0, N, M) << endl;
    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  string S;
  cin >> S;
  //'#'の数を数える累積和 R[i + 1] = S[i]までの和
  vector<int> R(N + 1);
  R[0] = 0;
  for(int i = 0; i < N; i++) {
    if(S[i] == '#') {
      R[i + 1] = R[i] + 1;
    } else {
      R[i + 1] = R[i];
    }
  }

  int ans = 1000000000;
  for(int i = 0; i < N + 1; i++) {
    int sharpSum = R[i];
    int dotSum = N - i - (R[N] - R[i]);
    ans = min(sharpSum + dotSum, ans);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1428
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pi 3.14
using namespace std;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef pair<long long,int> pli;
typedef pair<int,long long> pil;
const int INF=1000000007;
const int MOD=11092019;
const int nmax=201234;


int main()
{
    int n,k,res;
    scanf("%d%d",&k,&n);
    if(k<10)
        n+=100*(10-k);
    printf("%d\n",n);
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(unused_macros)]
macro_rules! chmax {
    ( $ x : expr , $ y : expr ) => { if $ x < $ y { $ x = $ y ; true } else { false } };
}

fn main() {
    input! {
        n: usize, m: usize,
        xy: [(usize1, usize1); m]
    }

    let mut g = vec![vec![];n];
    for i in 0..m {
        g[xy[i].0].push(xy[i].1);
    }
    let mut dp = vec![None;n];
    let mut ret = 0u64;
    for i in 0..n {
        chmax!(ret, rec(&g, &mut dp, i));
    }
    println!("{}", ret);
}

fn rec(g: &[Vec<usize>], dp: &mut [Option<u64>], c: usize) -> u64 {
    if let Some(src) = dp[c] {
        return src;
    }

    let mut ret = 0u64;
    for &v in &g[c] {
        chmax!(ret, rec(g,dp,v) + 1);
    }
    dp[c] = Some(ret);
    ret
}


Measured memory_bytes: 18684
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t n;
  cin >> n;
  vector<int64_t> a(n);
  rep(i,n){
    cin >> a.at(i);
  }
  int64_t mindist = 1000000000000;
  for(int64_t i=1;i <= 100;i++){
    int64_t dist = 0;
    rep(j,n){
      dist += (a.at(j)-i)*(a.at(j)-i);
    }
    mindist = min(mindist,dist);
  }
  cout << mindist << endl;
}
      
      
    

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<string>
#include<utility>
#include<iomanip>
#include<bitset>
#include<math.h>
using namespace std;

long long gcd(long long a,long long b){
	if(a == 0 || b == 0){
		return a^b;
	}
    if(a < b){
        swap(a,b);
    }
    long long r = a % b;
    while(r != 0){
        a = b;
        b = r;
		r = a % b;
    }
    return b;
}

vector<long long> divisor(long long n) {
  vector<long long> ret;
  for(long long i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

class UnionFind
{
	public:
    vector<long long> parent;

    UnionFind(long long n){
        parent = vector<long long>(n, -1);
    }

    long long root(long long n){
        if(parent[n] < 0){
            return n;
        }else{
            return parent[n] = root(parent[n]);
        }
    }

    long long size(long long n){
        return -parent[root(n)];
    }

    bool connect(long long a,long long b){
        a = root(a);
        b = root(b);
        if(a == b){
            return false;
        }
        if(size(a) < size(b)) swap(a,b);
        parent[a] += parent[b];
        parent[b] = a;
        return true;
    }

};


int main(){

	long long a,b;
	cin >> a >> b;
	vector<long long> v;
	
	long long n = gcd(a,b);
	v = divisor(n);
	
	UnionFind uf(v.size());
	
	for (long long i = 1; i < v.size(); i++)
	{
		for (long long j = i+1; j < uf.parent.size(); j++)
		{
			if(uf.parent[j] < 0){
				if(v[j] % v[i] == 0){
					uf.connect(i,j);
					//break;
				}
			}
		}
	}
	
	/*for (long long i = 0; i < uf.parent.size(); i++)
	{
		cout << uf.parent[i] <<endl;
	}*/
	long long ans = 0;
	for (long long i = 0; i < uf.parent.size(); i++)
	{
		if(uf.parent[i] < 0 ){
			ans ++;
		}
	}
	cout << ans << endl;
	
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m;
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(ll i=m/n;i>=1;i--){
        if(m%i==0){
            cout<<i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define reads(s) string s; cin >> s;
#define readarr(a, n) int a[(n) + 1] = {}; fori (i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori (i, 1, n) {fori (j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) fori (i, 1, n) {fori (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(s) (int)(s.size())
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
#define setprec(x) cout << fixed << setprecision(x)
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
 
const int INF = 4e18;
const int mod = 1e9+7; 

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

    //start from here

    readc(k, a, b);
    string s = "NG";

    fori (i, a, b) if(i % k == 0) s = "OK";

    cout << s;

    return 0;
}


Measured memory_bytes: 3644
#include<stdio.h>
#define N 10000

void sD(int,int);
int sH(int);
int gS(int);

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

Node T[N];
int n;
int D[N],H[N];

void sD(int a,int b){
  if(a==-1)return;
  D[a] = b;
  sD(T[a].l,b+1);
  sD(T[a].r,b+1);
}
int sH(int a){
  int x=0,y=0;
  if(T[a].l!=-1)x = sH(T[a].l)+1;
  if(T[a].r!=-1)y = sH(T[a].r)+1;
  return H[a]=(x>y?x:y);
}
int gS(int a){
  if(T[a].p == -1)return -1;
  if(T[T[a].p].l!=a && T[T[a].p].l != -1)return  T[T[a].p].l;
  if(T[T[a].p].r!=a && T[T[a].p].r != -1)return  T[T[a].p].r;
  return -1;
}

int main(){
  int i,v,l,r,d,root=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=-1;
  }
  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;

    if(l!=-1)T[l].p=v;
    if(r!=-1)T[r].p=v;

  }
  for(i=0;i<n;i++){
    if(T[i].p==-1)root = i;
}
  sD(root,0);
  sH(root);

  for(i=0;i<n;i++){
    printf("node %d: " , i);
    printf("parent = %d, ",T[i].p);
    printf("sibling = %d, ",gS(i));
    d = 0;

    if(T[i].l != -1)d++;
    if(T[i].r != -1)d++;
    printf("degree = %d, " , d);
    printf("depth = %d, ", D[i]);
    printf("height = %d, ", H[i]);


    if(T[i].p == -1)printf("root\n");
    else if(T[i].l == -1 && T[i].r == -1)printf("leaf\n");
    else printf("internal node\n");
  }
  return 0;
}

Measured memory_bytes: 624
#include<bits/stdc++.h>
using namespace std;
 
vector<pair<int, int> > G[10001];
 
int main()
{
    int N, M;
     
    scanf("%d %d", &N, &M);
     
    int x, y, z;
    while (scanf("%d %d %d", &x, &y, &z) && z){
        G[--x].push_back(make_pair(--y, z));
    }
     
    int L;
    scanf("%d", &L);
    for (int i = 0; i < L; i++){
        int A[10001], sum[10001] = {0};
        for (int j = 0; j < M; j++){
            scanf("%d", A + j);
        }
         
        for (int j = 0; j < N; j++){
            for (int k = 0; k < G[j].size(); k++){
                sum[j] += A[G[j][k].first] * G[j][k].second;
            }
        }
         
        for (int j = 0; j < N; j++){
            printf("%d%c", sum[j], j == N - 1 ? '\n' : ' ');
        }
    }
     
    return (0);
}

Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        long n=sc.nextLong();
        long copyn = n;
        long ans = 0;
        for(int i=2;i<=Math.sqrt(n);i++) {
            int count=1;
            while(n % (Math.pow(i,count)) == 0) {
                n = (long) ( n / Math.pow(i,count));
                count++;
                ans++;
            }

            while(n % i == 0) {
                n = n / i;
            }
        }

        if(copyn == 1) {
            System.out.println(0);
        } else if(n>1) {
            System.out.println( 1 + ans);
        } else {
            System.out.println(ans);
        }

    }
}

Measured memory_bytes: 35936
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
// cout<<fixed<<setprecision(10);
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main() {
    string a,b,c; cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0] <<  endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
long long jus[12]={
    1LL,
    10LL,

    100LL,
    1000LL,
    10000LL,

    100000LL,
    1000000LL,
    10000000LL,
    100000000LL,
    1000000000LL,

    10000000000LL,
    100000000000LL
};

long long digi_vol(int arr[12]){
    long long vol=0LL;
    for(int i=0; i<12; i++){
        vol+=(long long)arr[i]*jus[i];
    }
    return vol;
}

int main() {
    using namespace std;
    int k; cin >> k;
    long long runrun[100005] = {
        0,1,2,3,4,5,6,7,8,9,
        // 10,11,12,
        // 21,22,23,
        // 32,33,34,
        // 43,44,45,
        // 54,55,56,
        // 65,66,67,
        // 76,77,78,
        // 87,88,89,
        // 98,99,
        // 100,101,
        // 110,111,112,
        // 121,122,123,
        // 210,211,212,
        // 221,222,223,
        // 232,233,234,
    };
    runrun[100000]=3234566667;


    for(int p=8; p<=k; p++){
        long long pun = runrun[p-1]; // pre runrun
        int digi[12]={
            pun%10,
            (pun/10LL)%10,
            (pun/100LL)%10,
            (pun/1000LL)%10,
            (pun/10000LL)%10,
            (pun/100000LL)%10,
            (pun/1000000LL)%10,
            (pun/10000000LL)%10,
            (pun/100000000LL)%10,
            (pun/1000000000LL)%10,
            (pun/10000000000LL)%10,
            (pun/100000000000LL)%10
        };
        int maxketa=0;
        for(int i=0; i<12; i++){
            if(digi[i]!=0)maxketa=i;
        }
        for(int i=0; i<11; i++){
            if(maxketa==i){
                digi[i]++;
                if(digi[i]==10){
                    digi[i]=0;
                    digi[i+1]=1;
                }
                for(int j=i-1; j>=0; j--)
                    digi[j]=max(0,digi[j+1]-1);

                break;
            }

            if(abs(digi[i]+1-digi[i+1])<=1 && digi[i]!=9){
                digi[i]++;
                for(int j=i-1; j>=0; j--)
                    digi[j]=max(0,digi[j+1]-1);

                break;
            }
        }

        runrun[p]=digi_vol(digi);
        // cout << p << ';' << runrun[p] << endl;
    }

    cout << runrun[k] << endl;

    return 0;
}

Measured memory_bytes: 1024