akhauriyash/Code-Regression huggingface dataset:
a=[]
for i in range(5):
    a.append(int(input()))
b=[]
for i in range(5):
    for j in range(25):
        if a[i]<=j*10:
            b.append(j*10-a[i])
            break
    
b=sorted(b,reverse=True)
print(sum(a)+(sum(b)-b[0]))

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
using namespace std;
const int NIL = -1;
 
struct node {
    int parent;
    int left;
    int right;
};
 
node nodes[100000];
 
void preorder(int v) {
    if (v == NIL) return;
    printf(" %d", v);
    preorder(nodes[v].left);
    preorder(nodes[v].right);
}
 
void inorder(int v) {
    if (v == NIL) return;
    inorder(nodes[v].left);
    printf(" %d", v);
    inorder(nodes[v].right);
}
 
void postorder(int v) {
    if (v == NIL) return;
    postorder(nodes[v].left);
    postorder(nodes[v].right);
    printf(" %d", v);
}
 
int main()
{
    int n;
    for (int i = 0; i < 100000; ++i) {
        node &p = nodes[i];
        p.parent = NIL;
        p.left = NIL;
        p.right = NIL;
    }
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        int v, l, r;
        scanf("%d %d %d", &v, &l, &r);
        node &p = nodes[v];
        p.left = l;
        p.right = r;
        if (l != NIL) nodes[l].parent = v;
        if (r != NIL) nodes[r].parent = v;
    }
 
    int r = NIL;
    for (int i = 0; i < n; ++i) {
        if (nodes[i].parent == NIL) {
            r = i;
            break;
        }
    }
    printf("Preorder\n");
    preorder(r);
    printf("\nInorder\n");
    inorder(r);
    printf("\nPostorder\n");
    postorder(r);
    printf("\n");
 
    return 0;
}

Measured memory_bytes: 2216
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vi a(n);
    REP(i, n) cin >> a[i];
    vi dp(k + 1);
    REP1(i, k) REP(j, n) {
        if (i - a[j] >= 0 and dp[i - a[j]] == 0) dp[i] = 1;
    }
    cout << (dp[k] == 1 ? "First" : "Second") << endl;
}


Measured memory_bytes: 3700
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 999999
#define rep(i,j) for(int i=0;i<(j);++i)
#define reps(i,j,k) for(int i=j;i<k;++i)
typedef long long ll;
typedef unsigned long long ull;

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	vector< vector<int> > vvi(n+1);
	int ch[32]={0};
	rep(i,m){
		int x,y;
		scanf("%d%d",&x,&y);
		ch[y]++;
		vvi[x].push_back(y);
	}

	queue<int> Q;
	reps(i,1,n+1){
		if(ch[i] == 0)Q.push(i);
	}
	while(!Q.empty()){
		cout << Q.front() << endl;
		rep(i,vvi[Q.front()].size()){
			int x;
			x = vvi[Q.front()][i];
			if(--ch[x] == 0)Q.push(x);
		}
		Q.pop();
	}
	return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>

// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

inline bool chmin(ll &a, ll b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

inline bool chmax(ll &a, ll b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//桁数取得
template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}
//整数乗
ll llpow(ll a, ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        ll rep = a;
        for (ll i = 1; i < n; i++)
        {
            rep *= a;
        }
        return rep;
    }
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

template <typename T>
T amarinasi(T a, T b)
{
    if (a % b == 0)
    {
        return a / b;
    }
    else if (a % b > 0)
    {
        return a / b + 1;
    }
    else
    {
        return a / b - 1;
    }
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------
const double pi = 3.14159265358979323846264;

int main()
{
    ll x, k, d;
    cin >> x >> k >> d;
    x = llabs(x);
    ll wari = x / d;
    if (k - wari <= 0)
    {
        cout << x - k * d << endl;
    }
    else
    {
        if ((k - wari) % 2 == 0)
        {
            cout << x - wari * d << endl;
        }
        else
        {
            cout << d - (x - wari * d) << endl;
        }
    }
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

const int N=100000;
int ct[N]={0};
int num[N+1]={0};

priority_queue<int> que[N];

int main()
{
    int n,m;
    scanf(" %d %d", &n, &m);
    vector<int> x(n);
    rep(i,n) scanf(" %d", &x[i]);
    sort(all(x));

    rep(i,n) ++ct[x[i]%m];
    rep(i,n) ++num[x[i]];

    // まず和がmの倍数のペアを作る
    int ans=0;
    if(ct[0]>=2)
    {
        ans+=ct[0]/2;
        ct[0]%=2;
    }
    if(m%2==0)
    {
        if(ct[m/2]>=2)
        {
            ans+=ct[m/2]/2;
            ct[m/2]%=2;
        }
    }
    for(int i=1; i<=(m-1)/2; ++i)
    {
        int j=m-i;
        int v=min(ct[i],ct[j]);

        ans+=v;
        ct[i]-=v;
        ct[j]-=v;
    }

    // rep(i,m) printf("ct[%d]= %d\n", i,ct[i]);

    // 余ったもので同じ整数のペアが作れるか考える
    for(int i=1; i<=N; ++i)
    {
        if(num[i]==0) continue;
        int rem = i%m;
        que[rem].push(num[i]);
    }


    rep(i,m)
    {
        if(ct[i]==0) continue;

        while(!que[i].empty())
        {
            int val=que[i].top();
            que[i].pop();

            if(val>=2)
            {
                if(ct[i]<=val)
                {
                    ans+=ct[i]/2;
                    ct[i]%=2;
                }
                else
                {
                    ans+=val/2;
                    ct[i]-=(val/2)*2;
                }
            }
        }
    }

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


Measured memory_bytes: 7680
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	string s;
	while(cin>>N) {
		VI mi(26, INF);
		REP(i, N) {
			cin>>s;
			VI c(26);
			for(auto e: s) c[e-'a']++;
//			DD(c);
			REP(i, 26) minUpdate(mi[i], c[i]);
		}
//		DD(mi);
		string t;
		REP(i, 26) REP(j, mi[i]) t.PB('a'+i);
		cout<<t<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,d;
    cin>>n>>d;
    int res=n/(1+2*d);
    if((n%(2*d+1))!=0){res++;}
    cout<<res<<endl;
    return 0;
    }


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;

void main()
{
    auto input = readln.chomp.split(' ').to!(long[]);
    long N = input[0];
    long K = input[1];

    long ans;

    foreach (i; K + 1 .. N + 1)
    {
        //writeln("i=", i);
        long a = N / i;
        long b = i - K;

        long c = N % i - K + 1;

        //writeln("a=", a, ",b=", b, ",c=", c);

        ans += a * b;
        if (0 < c)
            ans += c;
        if (K == 0)
            ans--;
    }
    ans.writeln;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 2000001

int H, A[MAX];

void maxHeapify(int i){
  int l, r, largest, t;
  l = 2*i;
  r = 2*i+1;
  if(l <= H && A[l] > A[i])largest = l;
  else largest = i;
  if(r <= H && A[r] > A[largest])largest = r;
  if(largest != i){
    t = A[i];
    A[i] = A[largest];
    A[largest] = t;
    maxHeapify(largest);
  }
}

int main(){
  int i;
  scanf("%d",&H);
  for(i = 1;i <= H;i++)scanf("%d",&A[i]);
  
  for(i = H/2;i >= 1;i--)maxHeapify(i);

  for(i = 1;i <= H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  

  
  return 0;
}



Measured memory_bytes: 4648
using System;
using System.Linq;
public class s
{
  public static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    int[] x=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    int i,j;
    int max=0;
    int[] count=new int[100000+2];
    
    for(i=0;i<N;i++)
    {
       count[x[i]+2]++;
       count[x[i]+1]++;
       count[x[i]]++;
    }
    for(i=0;i<100001;i++)
    {
      if(count[i]>max)max=count[i];
    }
    Console.WriteLine(max);
  }
}

Measured memory_bytes: 18528
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x
	
using namespace std;
int main()
{

	
		int n;
		cin>>n;
		// bool arr[1000001];
		ll ans =0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				for(int k=1;k<=n;k++){
				ans+= __gcd(i,__gcd(j,k));	
					}	
				}
		}
		cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3636
import sys
import copy
input = sys.stdin.readline

N = int(input())
A = sorted(map(int,input().split()),reverse=True)

USED=[0]*(1<<N)
USED[0]=1

for i in range(N):
    NOW=0
    k=0
    BUSED=copy.deepcopy(USED)
    for j in range(1<<i):
        while BUSED[k]==0:
            k+=1
        while USED[NOW]==1 or A[k]<=A[NOW]:
            NOW+=1

            if NOW==1<<N:
                print("No")
                sys.exit()

        USED[NOW]=1
        k+=1


print("Yes")

Measured memory_bytes: 126776
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 2000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define dum2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define dum3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl

//ifstream in("Text.txt");cin.rdbuf(in.rdbuf());

int main() {
    int N;
    cin >> N;
    if (N == 1) {
        cout << 1 << endl;
        return 0;
    }
    int to = 0;
    while (N > 0) {
        to += N % 10;
        N /= 10;
    }
    if(to==1)cout << 10 << endl;
    else cout << to << endl;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//main code
VVL g;
VL rd;
queue<LL> q1;
queue<LL> q2;
LL ans = 1;
int n,k;

void dfs(int p, int v, int d1, int d2) {
	ans *= k - (d1+d2);
	ans %= MOD;
	for (auto&& var : g[v]) {
		if (var == p) {
			continue;
		}
		dfs(v, var, 1 ,d1);
		d1++;
	}
}
int main(int argc, char const* argv[])
{
	cin >> n >> k;
	g = VVL(n);
	rd = VL(n,0);
	for (int i = 0; i < n-1; i++) {
		int a,b;
		cin >> a >> b;
		a--;b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	q1.push(0);
	dfs(-1,0,0,0);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 10112
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <set>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define OUT(v) cout<<v<<endl
#define INF 1000000
#define MAX_N 42
#define MAX_A 402

int dp[MAX_N][MAX_A*MAX_A];
int main() {
  int N, M_a, M_b;
  cin >> N >> M_a >> M_b;

  int recipe[120];
  REP(i, N) {
    int a, b, c;
    cin >> a >> b >> c;
    recipe[3*i] = a;
    recipe[3*i+1] = b;
    recipe[3*i+2] = c;
  }
  // int dp[41][10];
  REP(i, N+1) {
    fill(dp[i], dp[i]+MAX_A*MAX_A, INF);
  }
  dp[0][0] = 0;
  REP(i, N) {
    REP(j, MAX_A) {
      REP(k, MAX_A) {
        if (j-recipe[3*i] >= 0 && k-recipe[3*i+1] >= 0)
          dp[i+1][j+k*MAX_A] = min(dp[i][j+k*MAX_A], dp[i][j-recipe[3*i]+(k-recipe[3*i+1])*MAX_A] + recipe[3*i+2]);
        else
          dp[i+1][j+k*MAX_A] = dp[i][j+k*MAX_A];
      }
    }
  }
  int res = INF;
  FOR(k, 1, MAX_A) {
    if (k * max(M_a, M_b) > 400)
      break;
    res = min(res, dp[N][M_a*k+M_b*k*MAX_A]);
  }

  if (res == INF)
    OUT(-1);
  else
    OUT(res);
  return 0;
}


Measured memory_bytes: 26112
#include <stdio.h>
#define X 200000

int main(){
  int n,i,j,m,a,b,c;
  int G[100][100],d[100],k[100];

  scanf("%d",&n);

  for(i=0; i<n; i++){
    k[i]=0;
    d[i]=X;
    for(j=0; j<n; j++){
      G[i][j]=-1;
    }
  }
  for(i=0; i<n; i++){
    scanf("%d %d",&a,&b);
    for(j=0; j<b; j++){
      scanf("%d",&c);
      scanf("%d",&G[a][c]);
    }
  }
  d[0]=0;
  
  while(1){
    m=X;
    for(i=0; i<n; i++){
      if(k[i]!=1 && d[i]<m){
	m=d[i];
	a=i;
      }
    }

    if(m==X){
      break;
    }
    for(i=0; i<n; i++){
      if(G[a][i]!=-1 && k[i]!=1 && d[a]+G[a][i]<d[i])
	d[i]=d[a]+G[a][i];
    }
    k[a]=1;
  }
  for(i=0; i<n; i++){
    printf("%d %d\n",i,d[i]);
  }
  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};

std::vector<int> dp;
std::vector<int> ckd;
std::vector<std::vector<int>> graph;

auto cal(int crr) {
  if (ckd.at(crr) == 2) return dp.at(crr);
  ckd.at(crr) = 1;
  for (auto nxt : graph.at(crr)) {
    if (ckd.at(nxt) == 1) {
      std::cout << -1 << std::endl;
      exit(0);
    }
    cmx(dp.at(crr), cal(nxt) + 1);
  }
  ckd.at(crr) = 2;
  return dp.at(crr);
}

auto encode(int i, int j) {
  if (i < j) std::swap(i, j);
  return i * (i - 1) / 2 + j;
}

int main() {
  int n; std::cin >> n;
  auto N = n * (n - 1) / 2;
  graph.resize(N);
  rep(i, 0, n) {
    auto v = std::vector<int>(n - 1);
    rep(j, 0, n) {
      if (i == j) continue;
      int x; std::cin >> x; x--;
      v.at(j - (i < j)) = encode(i, x);
    }
    rep(j, 0, n - 2) {
      graph.at(v.at(j)).emplace_back(v.at(j + 1));
    }
  }
  dp.resize(N, 1);
  ckd.resize(N, 0);
  auto ret = 0;
  rep(i, 0, N) {
    if (ckd.at(i) == 0) cmx(ret, cal(i));
  }
  std::cout << ret << std::endl;
  return 0;
}


Measured memory_bytes: 31616
N, A, B = map(int, input().rstrip().split())
total = 0
for i in range(1,N+1):
    answer = 0
    tmp = i
    while True:
        answer += i % 10
        i = i//10
        if i == 0:
            break
    if answer >= A and answer <= B:
        total += tmp
print(total)

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll N,A[202020];
ll As[202020];
ll i, j, k,ans;

bool bs(ll aa){
    ll i;
    fornum(i,2,N-1){
        ll cd = i;
        ll bc = upper_bound(As, As + i, As[i] / 2) - As;
        if(abs(As[i]-As[bc-1]*2)<abs(As[i]-As[bc]*2)){
            bc--;
        }

        ll de = upper_bound(As, As + N, (As[N] - As[i]) / 2 + As[i]) - As;
        if(abs(As[N]-As[de-1]*2+As[i])<abs(As[N]-As[de]*2+As[i])){
            de--;
        }
        ll mx = max(max(As[bc], As[cd] - As[bc]), max(As[de] - As[cd], As[N] - As[de]));
        ll mn = min(min(As[bc], As[cd] - As[bc]), min(As[de] - As[cd], As[N] - As[de]));

        //printf("%lld:%llda%lldb%lldc%lld\n", aa, bc, cd, de, abs(mx - mn));
        if(abs(mx-mn)<=aa){
            return true;
        }
    }
    return false;
}

int main(){
    scanf("%lld", &N);
    fornum(i,0,N){
        scanf("%lld", &A[i]);
        As[i + 1] = As[i] + A[i];
    }
    sort(A, A + N);
    ll b = A[N / 2];
    fornum(i,0,N){
        ans += abs(A[i] - b);
    }

    ll l = 0, r = 1e18;
    while(l<r){
        ll c = (l + r) / 2;
        if(bs(c)){
            r = c;
        }else{
            l = c + 1;
        }
    }

    printf("%lld\n", r);
    return 0;
}

Measured memory_bytes: 3328
x = int(input())
if 400 <= x <= 599 :
    print("8")
elif 600 <= x <= 799 :
    print("7")
elif 800 <= x <= 999 :
    print("6")
elif 1000 <= x <= 1199 :
    print("5")
elif 1200 <= x <= 1399 :
    print("4")
elif 1400 <= x <= 1599 :
    print("3")
elif 1600 <= x <= 1799 :
    print("2")
elif 1800 <= x <= 1999 :
    print("1")


Measured memory_bytes: 9172
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = ReadLine().Split(' ').Select(long.Parse).ToList();
            long n = nm[0];
            long m = nm[1];
            var a = ReadLine().Split(' ').Select(long.Parse).ToList();
            a.Sort();
            a.Reverse();
            int cnt = 0;
            while (true)
            {
                a[0] /= 2;
                cnt++;
                if (cnt == m) break;
                for (int i = 1; i < n; i++)
                {
                    if (a[i] >= a[0])
                    {
                        a[i] /= 2;
                        cnt++;
                        if (cnt == m) break;
                    }
                    else
                    {
                        break;
                    }
                }
                if (cnt == m) break;
                a.Sort();
                a.Reverse();
            }
            WriteLine(a.Sum());
        }

        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}

Measured memory_bytes: 28764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main()
{
	int c1,c2;
	std::cin >>c1 >>c2;
	int tmp = c1;
	ll count = 0;
	while(tmp<=c2){
		if (tmp%10==tmp/10000 && (tmp/10)%10==(tmp/1000)%10) count++;
		tmp++;
	}
	std::cout << count;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
a.sort()
oldi = 0
m = a[0]
M = 0
ans = 0
if N == 1:
  ans = 1
for i in range(1, N):
  M = a[i]
  while M - m > 2:
    oldi += 1
    m = a[oldi]
  if i - oldi + 1 > ans:
    ans = i - oldi + 1
print(ans)
  

Measured memory_bytes: 13964
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const int MOD = 1000000007;

int calc(int x){
    if (x < 10) return 0;
    string s = to_string(x);
    int res = 1, tmp = -1;
    rep((int)s.size()-1, i) {
        int a = stoi(s.substr(0, i+1)), b = stoi(s.substr(i+1));
        tmp = max(tmp, a*b);
    }
    res += calc(tmp);
    return res;
}

void solve(void){
    int Q;
    cin >> Q;
    rep(Q, i) {
        int a; cin >> a;
        cout << calc(a) << endl;
    }
}

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



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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    ll n,a,b;
    scanf("%lld %lld %lld",&n,&a,&b);
    string s ="";
    ll temp = n/(a+b),ans=0;
    ans+=temp*a;
    ll index = n%(a+b);
    ans+=min(index,a);
    printf("%lld",ans);
    return 0;
}

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

#define TOUMAX 4
#define KAIMAX 3
#define ROOMMAX 10

int main(void)
{

	int n,m;
	int i,j;
	int **array;
	int * a;
	int ans = 0;

	cin >> n;
	cin >> m;

	array = new int*[n];
	for (i = 0; i < n; i++) {
		array[i] = new int[m];
	}
	a = new int[m];


	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			cin >> array[i][j];
		}
	}
	for (i = 0; i < m; i++) {
		cin >> a[i];
	}

	for (i = 0; i<n; i++) {
		for (j = 0; j < m; j++) {
			ans += (array[i][j] * a[j]);
		}
		cout << ans << endl;
		ans = 0;
	}


	for (i = 0; i < n; i++) {
		delete[] array[i];
	}
	delete[] array;

	return 0;
}



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

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

ll p2(int i,int j,int n) {
	return 1ll<<((i>0?i-1:0)+(j+1!=n?n-j-2:0));
}

int main() {
	string s;
	cin >> s;
	ll r=0;
	for (int i=0;i<s.size();i++) {
		ll cur=0;
		for (int j=i;j<s.size();j++) {
			cur*=10;
			cur+=s[j]-'0';
			r+=cur*p2(i,j,s.size());
		}
	}

	cout << r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <list>
#define ll long long
using namespace std;
int main()
{
  ios_base::sync_with_stdio(0);
  ll a,b;
  cin >> a >> b;
  ll ans;
  if(b>=a)
    ans=0;
  else
    ans = abs(b-a);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
typedef struct shutugen{
	char words[33];
	int kaisu;
}shutugen;

int main(void){
	int i,j,k,topkaisu,endflag=0;
	char words[1001];
	shutugen tango[1000];
	
	for(i=0;i < 1000;i++){
		tango[i].words[0] = '\0';
		tango[i].kaisu = 0;
	}
	
	scanf("%[^\n]",words);
	getchar();
	
	i=0,j=0,k=0;
	for(i=0;words[i] != '\0';i++){
		if(isalpha(words[i])){
			tango[j].words[k]=words[i];
			k++;
		}else if(words[i] = ' '){
			// printf("%s\n",tango[j].words);
			k = 0;
			j++;
		}
	}
	// printf("%s\n",tango[j].words);
	
	//最も出現頻度が高い単語を探す
	topkaisu = 0;
	for(i=0;tango[i].words[0] != '\0';i++){
		for(j=i+1;tango[j].words[0] != '\0';j++){
			if(strcmp(tango[i].words,tango[j].words) == 0){
				tango[i].kaisu+=1;
				if(topkaisu < tango[i].kaisu) topkaisu = tango[i].kaisu;
			}
		}
	}
	//表示
	for(i=0;tango[i].words[0] != '\0';i++){
		if(topkaisu == tango[i].kaisu){
			printf("%s ",tango[i].words);
			break;
		}
	}
	
	// 文字数が多い単語を探す
	for(i=32;i > 0;i--){
		for(j=0;tango[j].words[0] != '\0';j++){
			if(isalpha(tango[j].words[i])){
				printf("%s\n",tango[j].words);
				endflag = 1;
				break;
			}
		}
		if(endflag == 1) break;
	}
	return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a, b;
  int p, q;
  string u;
  cin >> a >> b >> p >> q >> u;
  if (a == u) {
    cout << p - 1 << " " << q <<endl;
  }
  else {
    cout << p << " " << q - 1 <<endl;
  }
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())
h = [int(s) for s in input().split()]

min_abs = 100000
index = 0
for i in range(n):
    temp = t - h[i] * 0.006
    if abs(a - temp) < min_abs:
        min_abs = abs(a - temp)
        index = i
print(index + 1)

Measured memory_bytes: 9184
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <limits>
#include <vector>
#define ll long long
#define rep(i,n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair

using namespace std;

int main(){
    string s;
    cin >> s;
    rep(i,4){
        cout << s[i];
    }
    cout << " ";
    for(int i = 4;i < 12;i++){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int solve(int x, int y){
	if(y > 0){
		if(x < -y) return -y-x+1;
		if(x < 0) return y+x+1;
		if(x < y) return y-x;
		return x-y+2;
	}
	if(y == 0){
		if(x < 0) return -x;
		return x+1;
	}
	if(x < y) return y-x;
	if(x < 0) return -y+x+2;
	if(x < -y) return -y-x+1;
	return x+y+1;
}

int main(){
	int x, y;
	while(cin >> x >> y){
		cout << solve(x, y) << endl;
	}
}



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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;
    cin >> N;

    cout << N*N*N << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int geser;
	char t[10010];
	scanf("%d", &geser);
	scanf("%s", t);
	for (int i=0 ; t[i] != '\0' ; i++){
		t[i]+= geser;
		if (t[i]>'Z'){
			t[i]-=26;
		}
		printf("%c", t[i]);
	}
	puts("");
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int4(a, b, c, d);
    if(a * b < c * d)pri(c * d);
    else pri(a * b);

/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 3e5 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	MEM(a, 0x3f);
	for (int i = 1; i < n; i++)
	{
		int x;
		cin >> x;
		a[i] = min(a[i], x);
		a[i + 1] = min(a[i + 1], x);
	}
	int sum = 0;
	for (int i = 1; i <= n; i++)
		sum += a[i];
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
	
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		auto s = 1ULL;
		for (auto i = 0; i < 63; ++i, s <<= 1)
		{
			if (p & s)
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
}

template<class T>struct max_value
{
	T v;
	max_value(T u = 0) :v(u)
	{

	}
	auto& operator=(T const& u)
	{
		v = std::max(v, u);
		return *this;
	}
	auto& operator=(max_value const& u)
	{
		v = std::max(v, *u);
		return *this;
	}
	T operator*()const
	{
		return v;
	}
	void reset()
	{
		v = lib::min_v<T>;
	}
};

void Main()
{
	std::size_t R, C, K;
	std::cin >> R >> C >> K;
	boost::multi_array<max_value<std::int64_t>, 4> dp(boost::extents[R][C][4][2]);
	boost::multi_array<std::optional<std::int64_t>, 2> items(boost::extents[R][C]);
	for (auto _ : boost::irange(K))
	{
		index_t r, c;
		std::int64_t v;
		std::cin >> r >> c >> v;
		--r; --c;
		items[r][c] = v;
	}
	dp[0][0][0][0] = 0;
	max_value<std::int64_t> max;
	for (auto r : boost::irange(R))
	{
		for (auto c : boost::irange(C))
		{
			for (auto i : boost::irange(4))
			{
				if (i < 3 && items[r][c].has_value())
				{
					max = dp[r][c][i + 1][1] = *dp[r][c][i][0] + *items[r][c];
				}
				for (auto j : boost::irange(2))
				{
					if (r + 1 != R)
					{
						max = dp[r + 1][c][0][0] = dp[r][c][i][j];
					}
					if (c + 1 != C)
					{
						max = dp[r][c + 1][i][0] = dp[r][c][i][j];
					}
				}
			}
		}
	}
	std::cout << *max << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 706140
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lim 100000
#define mod 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define sd(n) scanf("%lld",&n)
int main()
{
  ll m;
  cin>>m;
  cout<<48-m<<endl;
}

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

int n, k;

int main() {
	cin >> n >> k;

	if (k == 0) {
		cout << (long long) n * n << endl;
		return 0;
	}
	long long rv = 0;

	for (int b = k + 1, q, r; b <= n; b++) {
		q = n / b, r = n % b;
		rv += (long long) q * (b - k) + max(0, r + 1 - k);
	}
	cout << rv << endl;
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a, ans;
map<int,int> m;

int main() {
	cin >> n;
	rep(i,n) {
		cin >> a;
		m[a]++;
	}
	each(it,m) if (it.se%2==1) ans++;
	cout << ans << ln;
}

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

int N;
const int MOD = 1.0e9 + 7;

bool is_prime(int n) {
    if (n <= 1) return false;
    else {
        for (int i = 2; i*i <= n; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}

int main() {
    cin >> N;

    ll ans = 1;
    for (int i = 1; i <= N; i++) {
        if (is_prime(i)) {
            int cnt = 0;
            for (int j = i; j <= N; j++) {
                int num = j;
                while (num % i == 0) {
                    num /= i;
                    cnt++;
                }
            }
            ans = (ans * (cnt+1)) % MOD;
        }
    }

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


Measured memory_bytes: 256
A, B, C = map(int, input().split())
ans = 0
while((A==B==C) == False):
    if A == B:
        if A > C:   # AとBが同じでかつCが最小
            C += 2
        else:
            A += 1
            B += 1

    elif B == C:
        if B > A:   # BとCが同じでかつAが最小
            A += 2
        else:
            B += 1
            C += 1

    elif C == A:
        if C > B:   # CとAが同じでかつBが最小
            B += 2
        else:
            C += 1
            A += 1
    else :           # 3つの変数がバラバラの時
        if A > B > C or A > C > B:
            B += 1
            C += 1
        elif B > A > C or B > C > A:
            A += 1
            C += 1
        else:
            A += 1
            B += 1
    ans += 1
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;

void sieve(bool* pn){
		for(int i=2;i<sqrt(50100.);++i){
		if(pn[i]){
			for(int j=i*2;j<=50100;j+=i){
				pn[j]=false;
			}
		}
	}
}

int main(){
	bool pn[50100];
	int ans[50001];
	memset(pn , true , sizeof(pn));
	pn[0]=pn[1]=false;
	sieve(pn);
	int i , j=2 , n , len=0;
	for(i=0 ; i<=50000 ;++i ){
		if(pn[i]) len++;
	}
	int* prime = new int [len];
	for(i=0;i<len;++i){
		while(1){
			if(pn[j]){
				prime[i]=j;
				j++;
				break;
			}
			j++;
		}
	}
	for(i=0 ; prime[i] <=25000 ;++i){
		for(j=i ;prime[i]+prime[j]<=50000;++j){
			ans[prime[i]+prime[j]]++;
		}
	}
	
	while(cin >> n , n){
		cout << ans[n] << endl;
	}
	delete [] prime;
	return 0; 
}

Measured memory_bytes: 1464
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long int li;

int main(void){
    ll n;
    ll od=0;
    ll ev=0;
    cin >> n;
    ll a[n+1];
    for(ll i=1;i<n+1;i++)cin >> a[i];
    for(ll i=1;i<n+1;i++){
        if(a[i]%2==0)ev++;
        if(a[i]%2==1)od++;
    }
    if(od==n){cout << "first" << endl;}
    else if(ev==n){cout << "second" << endl;}
    else if(od%2==1&&ev%2==1){cout << "first" << endl;}
    else if(od%2==0&&ev%2==1){cout << "first" << endl;}
    else if(od%2==1&&ev%2==0){cout << "first" << endl;}
    else if(od%2==0&&ev%2==0){cout << "first" << endl;}
    return 0;
}


Measured memory_bytes: 1024
package main

import (
	"bufio"
	"container/list"
	"fmt"
	"os"
)

func scanBytes(scanner *bufio.Scanner) (bs []byte) {
	if scanner.Scan() {
		return scanner.Bytes()
	}
	return
}

func main() {
	buf := make([]byte, 262144)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(buf, cap(buf))
	scanner.Split(bufio.ScanWords)

	x := scanBytes(scanner) // 2 <= |x| <= 200,000
	list := list.New()
	for _, b := range x {
		if b == 'S' || list.Len() == 0 {
			list.PushBack(b) // 'S' or 'T'
			continue
		}
		// b == 'T':
		if back := list.Back(); back.Value.(byte) == 'S' {
			list.Remove(back)
			continue
		}
		list.PushBack(b)
	}
	fmt.Println(list.Len())
}


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

typedef vector<vector<int> > mat;

void show(const mat &t){
  cout << "--\n";
  for(int i = 0; i < 5; i++){
    for(int j = 0; j < 5; j++){
      printf("%3d", t[i][j]);
    }
    cout << endl;
  }
}

int sc[5];
int ans;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int delBlock(mat &t, int bonus){
  mat t_tmp = t;

  for(int i = 0; i < 5; i++){
    for(int j = 0; j < 5; j++){
      if(t[i][j] == -1) continue;

      for(int k = 0; k < 2; k++){
        int cnt = 0;
        int nx = j;
        int ny = i;

        while(nx < 5 && ny < 5 && t[ny][nx] == t[i][j]){
          cnt++;
          nx += dx[k];
          ny += dy[k];
        }

        if(cnt < 3) continue;

        nx = j;
        ny = i;

        while(nx < 5 && ny < 5 && t[ny][nx] == t[i][j]){
          t_tmp[ny][nx] = -1;
          nx += dx[k];
          ny += dy[k];
        }
      }
    }
  }

  bool flg = false;
  int res = 0;

  for(int i = 0; i < 5; i++){
    for(int j = 0; j < 5; j++){
      if(t[i][j] != -1 && t_tmp[i][j] == -1){
        flg = true;
        res += sc[t[i][j] - 1] * bonus;
      }
    }
  }

  t = t_tmp;

  return flg ? res : -1;
}

void dropBlock(mat &t){
  for(int i = 3; i >= 0; i--){
    for(int j = 0; j < 5; j++){
      if(t[i][j] == -1) continue;

      int ni;
      for(ni = i + 1; ni < 5 && t[ni][j] == -1; ni++);
      ni--;
      swap(t[ni][j], t[i][j]);
    }
  }
}

void dfs(int rem, mat t, int x, int y){
  mat nt = t;
  int bonus = 1;
  int score = 0;

  while(true){
    int tmp = delBlock(nt, bonus);
    if(tmp == -1) break;
    score += tmp;
    dropBlock(nt);
    bonus++;
  }

  ans = max(ans, score);
  if(rem == 0) return;

  for(int i = 0; i < 4; i++){
    int nx = x + dx[i];
    int ny = y + dy[i];
    if(nx < 0 || 5 <= nx || ny < 0 || 5 <= ny) continue;

    nt = t;
    swap(nt[y][x], nt[ny][nx]);
    dfs(rem - 1, nt, nx, ny);
  }
}

void solve(mat t, int n){
  ans = -1;

  for(int i = 0; i < 5; i++){
    for(int j = 0; j < 5; j++){
      dfs(n, t, j, i);
    }
  }

  cout << ans << endl;
}

int main(){
  int n;

  while(cin >> n, n != -1){
    mat t;

    for(int i = 0; i < 5; i++){
      t.push_back(vector<int>());

      for(int j = 0; j < 5; j++){
        int x;
        cin >> x;
        t[i].push_back(x);
      }
    }

    for(int i = 0; i < 5; i++){
      cin >> sc[i];
    }

    solve(t, n);
  }
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int mod =1e9+7;
const int N = (int)2e5 + 5;
ll a,b,n;
ll ans=0;
bool check(ll x){
	ll a1=x*a/b;
	ll a2=x/b;
	ll a3=a2*a;
	if(a1-a2>ans)return true;
	return false;
}

void solve(){
    cin>>a>>b>>n;
    ll l=0,r=n;
    if(n<b){
    	cout<<n*a/b;
    	return;
    }
    else{
    	cout<<(b-1)*a/b;
    	return;
    }
}

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

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

int main() {

    int a, b;
    cin >> a >> b;
    int d, r;
    double f;
    d = a / b;
    r = a % b;
    f = 1.0 * a / b;
    cout << d << " " << r << " " ;
    printf("%5lf\n", f);
}


Measured memory_bytes: 3232
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 2019
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int L, R;
    cin >> L >> R;
    R = min(R, L + 2020);
    int ans = INF;
    REP(i, L, R) {
        REP(j, i + 1, R) {
            ans = min(ans, (i * j) % mod);
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256