akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>
#include <cstdio>
 
using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
 
using int64 = long long;
using P = pair<int,int>;
using TP = tuple<int,int,int>;
 
int main() {
    int h,w,ch,cw,dh,dw;
    scanf("%d %d %d %d %d %d",&h, &w,&ch,&cw,&dh,&dw);
 
    char s[h+1][w+1];
    for (int i=0; i<h; i++) {
        scanf("%s",s[i]);
    }
 
    vector num(h, vector(w,-1));
 
    const vector dx = {-1,0,+1,0};
    const vector dy = {0,+1,0,-1};
 
    const vector dx2 = {-2,-2,-1,-1,+1,+1,+2,+2};
    const vector dy2 = {-2,+1,-1,+1,+1,-1,-2,+2};
 
    deque<TP> q;
    q.emplace_back(ch-1,cw-1, 0);
    while(!q.empty()) {
        auto [y,x,c] = q.front(); q.pop_front();
        if (num[y][x]>=0 && num[y][x]<c) continue;
        num[y][x] = c;
 
        for (short i=0; i<4; i++) {
            const int xi = x + dx[i];
            const int yi = y + dy[i];
            if (xi<0 || w<=xi) continue;
            if (yi<0 || h<=yi) continue;
            if (s[yi][xi] != '.') continue;
            if (num[yi][xi]>=0 && num[yi][xi]<=c) continue;
            if (num[yi][xi]!=-1) num[yi][xi]=min(num[yi][xi], c);
            q.emplace_front(yi,xi,c);
        }
 
        for (short i=-2; i <=2; i++) {
            for (short j=-2; j<=2; j++) {
                const int xi = x + j;
                const int yi = y + i;
                if (xi < 0 || w <= xi) continue;
                if (yi < 0 || h <= yi) continue;
                if (s[yi][xi] != '.') continue;
                if (num[yi][xi] >= 0 && num[yi][xi] <= c + 1) continue;
                q.emplace_back(yi, xi, c + 1);
            }
        }
    }
 
 
    cout << num[dh-1][dw-1] << endl;
}


Measured memory_bytes: 8760
#include <iostream>
#include <string>

int main()
{
  std::string s;
  bool flag = false;

  std::cin >> s;

  for (int x=0; x < s.length(); ++x){

    if ( 0 == x % 2){
      //偶数なら
      if (s[x] == 'L'){
        flag = true;
      }
    }else {
      //奇数なら
      if (s[x] == 'R'){
        flag = true;
      }
    }

    if (flag == true){
      break;
    }
  }

  if (flag == true){
    std::cout << "No" << std::endl;
  }else{
    std::cout << "Yes" << std::endl;
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef string str;
typedef vector<str> vst;typedef vector<ll> vll;
ll mod = 1000000007, INF = 10000000000000000;
ll gcd(ll a, ll b){if(b==0){return a;}return gcd(b, a%b);}
ll digit(ll x){ll c=0;while(x>0){x=x/10;c++;}return c;}
// for (ll i = 0; i < n; i++) {
// sort(.begin(), .end());

int main(){
  ll n,l,tmp=1000000;
  cin>>n>>l;
  
  ll sum=(n*l+n*(n-1)/2);
  
  for (ll i = 0; i < n; i++) {
    if(abs(tmp)>abs(l+i)){
      tmp=l+i;
    }
  }

  cout<<sum-tmp<<endl;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

struct edge{int to, com;};

vector<PII> g[500010];
int d[500010];
map<int, int> mp[100010];
int num;

void addedge(int x, int y) {
  if(mp[x].count(y) == 0) {
    mp[x][y] = num++;
    g[mp[x][y]].PB(MP(x, 0));
    // cout << mp[x][y] << " " << x << " cost:" << 0 << endl;
    g[x].PB(MP(mp[x][y], 1));
    // cout << x << " " << mp[x][y] << " cost:" << 1 << endl;
  }
}

signed main(void)
{
  int n, m;
  cin >> n >> m;
  num = n;
  REP(i, m) {
    int x, y, z;
    cin >> x >> y >> z;
    --x, --y;
    addedge(x, z);
    addedge(y, z);
    // cout << mp[x][z] << " " << mp[y][z] << " cost:" << 0 << endl;
    g[mp[x][z]].PB(MP(mp[y][z], 0));
    g[mp[y][z]].PB(MP(mp[x][z], 0));
    // cout << mp[y][z] << " " << mp[x][z] << " cost:" << 0 << endl;
  }

  /*REP(i, n+m) {
    cout << "i:" << i << endl;
    REP(j, g[i].size()) {
      cout << "(" << g[i][j].first << "," << g[i][j].second << ")";
    }
    cout << endl;
  }*/

  priority_queue<PII, vector<PII>, greater<PII>> que;
  que.push({0, 0});
  memset(d, 0x3f, sizeof(d));
  d[0] = 0;

  while(que.size()) {
    PII v = que.top(); que.pop();
    //cout << v.first << " " << v.second << endl;
    if(d[v.second] < v.first) continue;
    REP(i, g[v.second].size()) {
      int a = g[v.second][i].first, b = g[v.second][i].second;
      //cout << "a:" << a << " b:" << b << endl;
      if(d[a] > v.first + b) {
        d[a] = v.first + b;
        que.push(MP(d[a], a));
      }
    }
  }

  if(d[n-1] == 0x3f3f3f3f) cout << -1 << endl;
  else cout << d[n-1] << endl;

  return 0;
}


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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cout<<#x<<" = "<<x<<endl;

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
    li n;

    cin>>n;

    char a[n];

    li cntr=0,cntw=0;

    f(i,0,n-1)
    {
        cin>>a[i];

        if(a[i]=='W')
            cntw++;
        else
            cntr++;
    }

    li ans=min(cntw,cntr);

    li cnt=0;

    f(i,0,cntr-1)
    {
        if(a[i]!='R')
            cnt++;
    }

    ans=min(ans,cnt);

    cout<<ans;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t=1;

    // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3848
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	long long x,k,d,syo,a,ans;
	scanf("%lld %lld %lld",&x,&k,&d);
	if(x<0) x=-x;
	syo=x/d;
	if(syo>=k)	ans=x-d*k;
	else {
		if(k%2==0)	{
			if(syo%2==0)	ans=x-d*syo;
			else {
				ans=x-d*syo-d;
				if(ans<0)	ans=-ans;
			}
		}
		else {
			if(syo%2==1)	ans=x-d*syo;
			else {
				ans=x-d*syo-d;
				if(ans<0)	ans=-ans;
			}
		}
	}
	printf("%lld\n",ans);
			
	return 0;
}

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

int max(int a,int b){
	if(a>=b)return a;
	else return b;
}

int min(int a,int b){
	if(a>=b)return b;
	else return a;
}

void swap(int *a,int *b){
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

void babbleSort(int *data,int n){
	for(int i=0;i<n;i++){
		for(int j=n-1;j>i;j--){
			if(data[j]>=data[j-1]){
				swap(&data[j],&data[j-1]);
			}
		}
	}
}


using namespace std;

/*
cin.ignore();
	getline(cin,dataStr);
	data = new int[n];
	stringToInteger(&dataStr,data,n);
*/

void stringToInteger(string *str,int *data,int n){
	for(int i=1;i<=n;i++){
		int spaceN = str->find(' ',0);

		data[i] = atoi(str->substr(0,spaceN).c_str());
		str->erase(0,spaceN+1);
	}
}

int main(){

	int n;
	int *a;

	int ans[5001];
	int cnt=0;

	while(1){
	cin>>n;

	if(n==0)break;
	a = new int[n];

	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int max=-10000000;
	int before=0;
	int now=0;

	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			if(j==i){
				before=a[j];
				now=before;
			}
			else{
				now=before+a[j];
			}
			
			if(max<=now){
				max = now;
	
			}
			before=now;
		}
	}
	ans[cnt]=max;
	//cout<<max<<endl;
	cnt++;

	}
	for(int i=0;i<cnt;i++){
		cout<<ans[i]<<endl;
	}


	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <iomanip>
#include <tuple>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;
void init();
#ifdef DEBUG_BUILD
#define DBG(expr) cout << #expr << " = " << expr << endl;
#endif
#define ECHO(expr) cout << expr << endl;
#define REP(var, num) for(ll var = 0; var < num; var++)
#define REP_FROM(var, from, num) for(ll var = from; var < num; var++)
#define MAX_OF(type) numeric_limits<type>::max()
#define MIN_OF(type) numeric_limits<type>::min()
#define SORT(vec) sort(vec.begin(), vec.end())
#define REVERSE(vec) reverse(vec.begin(), vec.end())
#define T_FIRST(tuple) (std::get<0>(tuple))
#define T_SECOND(tuple) (std::get<1>(tuple))
#define T_THIRD(tuple) (std::get<2>(tuple))
typedef signed long long ll;
typedef unsigned long long ull;

void solve() {
    ll a, b;
    cin >> a >> b;
    ll 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;
}

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

#ifdef INPUT_FILE
    if (!freopen(INPUT_FILE, "r", stdin)) {
        perror("freopen");
        exit(1);
    }
#endif

    solve();
    return 0;
}

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


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

    long B[N-1];
    for(int i = 0; i < N -1 ; i++) cin >> B[i];

    long answer = 0L;
    long previousValue = 9999999999;
    for(int i = N-2; i >= 0; i--) {
        answer += min(B[i],B[i+1]);
    }
  	answer += B[0];
    
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
using namespace std;

const double inf = 1e10;

struct D{
  vector<double>l,r;
  D():l(3,inf),r(3,-inf) {}
  void add(double x,int v){
    ++v;
    mins(l[v],x);
    maxs(r[v],x);
  }
  double get(double t){
    double nl = inf, nr = -inf;
    rep(i,3){
      mins(nl,l[i]+i*t);
      maxs(nr,r[i]+i*t);
    }
    return nr-nl;
  }
  vector <double> events(){
    vector<double>ts;
    rep(i,3)rep(j,i){
      {
        double t = (l[j]-l[i])/(i-j);
        if(t>0)ts.push_back(t);
      }
      {
        double t = (r[j]-r[i])/(i-j);
        if(t>0)ts.push_back(t);
      }
    }
    return ts;
  }
};

int main(){
  int n;
  cin >> n;
  D xd,yd;
  rep(i,n){
    int x,y;
    char d;
    cin >> x >> y >> d;
    if (d == 'L') xd.add(x,-1), yd.add(y,0);
    if (d == 'R') xd.add(x,1), yd.add(y,0);
    if (d == 'U') xd.add(x,0), yd.add(y,1);
    if (d == 'D') xd.add(x,0), yd.add(y,-1);
  }
  vector<double> ts;
  ts.push_back(0);
  ts.push_back(inf);
  {
    auto nts =xd.events();
    ts.insert(ts.end(),nts.begin(),nts.end());
  }
  {
    auto nts = yd.events();
    ts.insert(ts.end(),nts.begin(),nts.end());
  }
  sort(ts.begin(),ts.end());
  double ans = 1e18;
  for(double t : ts){
    double now = xd.get(t)*yd.get(t);
    mins(ans,now);
  }
  printf("%.10f\n", ans);
  return 0;
}


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

void solve() {
    int N;
    cin >> N;
    vector<ll> a(N),b(N);
    for(int i=0;i<N;i++) cin >> a[i] >> b[i];
    ll cnt=0;
    for(int i=N-1;i>=0;i--) {
        a[i]+=cnt;
        cnt+=(a[i]+b[i]-1)/b[i]*b[i]-a[i];
    }
    cout << cnt << "\n"; 
}

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

    solve();
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N, K;
	cin >> N >> K;
	
	vector<int> P(N), C(N);
	REP(i, N) scanf("%d", &P[i]), --P[i];
	REP(i, N) scanf("%d", &C[i]);
	
	vector<bool> done(N);
	ll ans = -longINF;
	
	REP(s, N) {
		if (done[s]) continue;
		
		vector<int> cycle;
		auto dfs = [&](auto dfs, int x) {
			if (done[x]) return;
			done[x] = true;
			cycle.emplace_back(x);
			dfs(dfs, P[x]);
		};
		dfs(dfs, s);
		
		int sz = cycle.size();
		
		ll loopsum = 0;
		REP(i, sz) loopsum += C[P[cycle[i]]];
		
		REP(i, sz) {
			int p = P[cycle[i]];
			ll cur = C[p];
			
			FOR(j, 1, sz + 1) {
				if (j > K) break;
				if (loopsum > 0) chmax(ans, cur + (K - j) / sz * loopsum);
				else chmax(ans, cur);
				p = P[p];
				cur += C[p];
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll)1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll h, w, n;
    cin >> h >> w >> n;
    vec<P> xy(n);
    for(auto &[x, y] : xy) {
        cin >> x >> y;
        x--;
        y--;
    }
    sort(all(xy));

    bitset<202020> bit;
    bit.set(0);
    int pos = 0;
    while(pos < n and xy[pos].first == 0) {
        pos++;
    }

    rep(i, 1, h) {
        vec<int> p;
        while(pos < n and xy[pos].first == i) {
            if(bit[xy[pos].second]) {
                cout << i << en;
                return;
            }
            p.push_back(xy[pos].second);
            pos++;
        }
        bit |= (bit << 1);
        for(auto y : p) {
            bit[y] = 0;
        }
    }
    cout << h << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 6300
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
ll mod = 1000000007;
ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);

vector<pair<ll,ll>> factorize(ll x){//mapを返す関数
    vector<pair<ll,ll>> v;
    for(ll i=2;i*i<=x;i++){
        ll cnt=0;
        while(x%i==0){
            x/=i;
            cnt++;
        }
        v.pb({i,cnt});
    }
    if(x!=1){
        if(x==v.back().fi) v.back().se++;//xが素数だった時用
        else v.pb({x,1});
    }
  
  return v;
}

const ll MAX = 100100;//設定して

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;//＊１
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

signed main(){
    ll n,m,ans=1;
    cin>>n>>m;
    vector<pair<ll,ll>> u = factorize(m);
    COMinit();

    for(ll i=0;i < u.size();i++)
    {
        ans*=COM(n-1+u.at(i).se,u.at(i).se);
        ans%=mod;
    }

    cout << ans << endl;
}

Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int a = scanner.nextInt();
        final int b = scanner.nextInt();
        final int c = scanner.nextInt();
        final long k = scanner.nextLong();

        System.out.println(k % 2 == 0 ? a - b : b - a);
    }
}


Measured memory_bytes: 23508
#include <iostream>
#include <algorithm>
using namespace std;;
using ll=long long;
// combination table
ll C[51][51];  //C[n][k] -> nCk


void comb_table(int N){
    for(int i=0;i<=N;++i){
        for(int j=0; j<=i; ++j){
            if(j==0 or j==i){
                C[i][j]=1LL;
            }else{
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}

int main(){
    // input
    int N, A, B;
    cin >> N >> A >> B;

    const int NMAX=50;
    ll v[NMAX];

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

    comb_table(N);
    sort(v, v+N);
    reverse(v,v+N);

    double max_average=0.0;
    for(int i=0; i<A; i++){
        max_average+=v[i];
    }
    max_average/=A;

    int a_th_val_num=0, a_th_val_pos=0;
    for(int i=0; i<N; i++){
        if(v[i]==v[A-1]){
            a_th_val_num++;
            if(i<A){
                a_th_val_pos++;
            }
        }
    }

    ll cnt=0LL;
    if(a_th_val_pos==A){
        for(a_th_val_pos=A; a_th_val_pos<=B; ++a_th_val_pos){
            cnt+=C[a_th_val_num][a_th_val_pos];
        }
    }else{
        cnt+=C[a_th_val_num][a_th_val_pos];
    }

    cout.precision(20);
    cout << fixed << max_average << endl;
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int[][] a = new int[2][];
        a[0] = sc.IntArray();
        a[1] = sc.IntArray();

        var dp = new int[2, n];
        dp[0, 0] = a[0][0];
        for (int i = 0; i < n; i++)
        {
            if (i > 0)
                dp[0, i] = dp[0, i - 1] + a[0][i];
            dp[1, i] = dp[0, i];
            if (i > 0)
            {
                dp[1,i] = Math.Max(dp[1,i], dp[1,i-1]);
            }

            dp[1, i] += a[1][i];
        }

        Console.WriteLine(dp[1,n-1]);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13396
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main()
	{
		var AB = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));

		if (AB[1] % AB[0] == 0) {
			Console.WriteLine(AB.Sum());
		} else {
			Console.WriteLine(AB[1] - AB[0]);
		}

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[110];
	int i=1,flag=0;
	while(cin>>a[i])
	{
		if(a[i]=='C')flag=1;
		if(a[i]=='F'&&flag==1)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int N,R,inner_rating,i;
    scanf("%d %d",&N,&R);
    if(N<10)
    {
    	i=100*(10-N);
    	inner_rating=i+R;
	}
	else 
	{
		inner_rating=R;
	}
	printf("%d\n",inner_rating);
	return 0;
}


Measured memory_bytes: 128
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
#define LL long long
const int N=100005;
int v[N*2],nxt[N*2],point[N],bs;
int vis[N],ds[N],ff;
LL a[N],ct[N];
void addedge(int x,int y)
{
    bs++;v[bs]=y;nxt[bs]=point[x];point[x]=bs;
    bs++;v[bs]=x;nxt[bs]=point[y];point[y]=bs;
}
void dfs(int x)
{
    if (ds[x]==1) {vis[x]=1;ct[x]=a[x];return;}
    int p;LL sum=0,R,mx=0;vis[x]=1;
    for (p=point[x];p;p=nxt[p])
     if (!vis[v[p]])
     {
            dfs(v[p]);if (ff) return;
            sum+=ct[v[p]];mx=max(mx,ct[v[p]]);
     }
    R=sum-a[x];if (R<0) ff=1;
    ct[x]=sum-2*R;if (ct[x]<0) ff=1;
    if (sum-mx<R) ff=1;
}
int main()
{
   // freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
    int i,n,tot=0,rt;
    scanf("%d",&n);
    for (i=1;i<=n;i++) scanf("%lld",&a[i]);
    if (n==2) {if (a[1]==a[2]) puts("YES"); else puts("NO");return 0;}
    for (i=1;i<n;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        addedge(x,y);ds[x]++,ds[y]++;
    }
    for (i=1;i<=n;i++) if (ds[i]>1) break;
    rt=i;dfs(rt);if (ct[rt]>0) ff=1;
    if (ff) puts("NO"); else puts("YES");
    
    return 0;
}


Measured memory_bytes: 8576
#数列 a={a1,a2,a3,.....} は、以下のようにして定まります。
#初項 s は入力で与えられる。
#関数 f(n) を以下のように定める:
#n が偶数なら f(n)=n/2、n が奇数なら f(n)=3n+1。
#i=1 のとき ai=s、i>1 のとき ai=f(ai−1) である。
#このとき、次の条件を満たす最小の整数 m を求めてください。
#am=an(m>n) を満たす整数 n が存在する。

def f(s): #関数を定義(cntを出力？)
    cnt = 0
    st = set() #空の集合

    cnt += 1
    st.add(s) #集合に初項を追加

    while True:
        cnt += 1

        if s % 2 == 0:
            tmp = s / 2
        else:
            tmp = 3 * s + 1

        if tmp in st: #値が集合に存在した場合break
            break

        st.add(tmp) #集合に項を追加
        s = tmp
    return cnt


s = int(input())#初項を入力
ans = f(s) #関数を出力
print(ans)
    

Measured memory_bytes: 38256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

static const int MAX_BUCKET = 1000;
vector<int> bucket[MAX_BUCKET];

int compute_dist(int dist,int lhs,int rhs){
  return min(dist-abs(lhs-rhs),abs(lhs-rhs));
}

int main(){
  int total_dist,store_num,order_num;
  while(~scanf("%d",&total_dist)){
    if(total_dist == 0) break;
    scanf("%d",&store_num);
    scanf("%d",&order_num);

    vector<int> store;
    store.push_back(0);
    for(int i=0;i<store_num-1;i++){
      int num;
      scanf("%d",&num);
      store.push_back(num);
    }
    sort(store.begin(),store.end());

    int cost = 0;
    for(int i=0;i<order_num;i++){
      int num;
      scanf("%d",&num);

      int idx1 = lower_bound(store.begin(),store.end(),num) - store.begin();
      int idx2 = (idx1 + store.size() - 1) % store.size();
      int min_dist = min(compute_dist(total_dist,store[idx1],num),
			 compute_dist(total_dist,store[idx2],num));
      
      cost += min_dist;
    }
    printf("%d\n",cost);
  }
}

Measured memory_bytes: 1732
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
//#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int N;
    int K;
    
    cin >> N;
    cin >> K;

    if(N%K==0) cout << 0;
    else cout << 1;
    

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}

ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main (){
    int n;
    ll ans=0;
    cin >> n;
    vector<vector<int>>num(9,vector<int>(9,0));
    for(ll i=1;i<=n;i++){
        ll keta=log10(i)+1;
        ll hd=i/pow(10,keta-1);
        ll tl=i%10;
        if(tl==0) continue;
        num[hd-1][tl-1]++;
    }
    for(int i=0;i<9;i++){
        for(int j=0;j<9;j++){
            ans+=num[i][j]*num[j][i];
        }
    }
    cout << ans <<endl;
    return 0;
}



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

const int INF = (int)1e9;

int A[100000];
int dp[100000];

int main() {
	ios::sync_with_stdio(false);
	int n; cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];
	fill(dp, dp + n, INF);
	for (int i = 0; i < n; i++) {
		*lower_bound(dp, dp + n, A[i]) = A[i];
	}
	cout << (lower_bound(dp, dp + n, INF) - dp) << endl;
}

Measured memory_bytes: 1976
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int md=1000000007;
int n,K,i,j,f[2005][2005],jc[4000005],rjc[4000005],inv[4000005];
int C(int n,int m)
{
	return 1ll*jc[n]*rjc[m]%md*rjc[n-m]%md;
}
int main()
{
	scanf("%d%d",&n,&K);
	if(K==1)
	{
		printf("1");
		return 0;
	}
	inv[1]=1;
	for(i=2;i<=n*K;++i)
		inv[i]=1ll*inv[md%i]*(md-md/i)%md;
	jc[0]=rjc[0]=1;
	for(i=1;i<=n*K;++i)
	{
		jc[i]=1ll*jc[i-1]*i%md;
		rjc[i]=1ll*rjc[i-1]*inv[i]%md;
	}
	f[1][0]=1;
	for(i=1;i<=n;++i)
		for(j=0;j<=i;++j)
		{
			if(i<n)
				f[i+1][j]=(f[i+1][j]+f[i][j])%md;
			if(j<i)
				f[i][j+1]=(f[i][j+1]+1ll*f[i][j]*(n-j)%md*C(n*K-i-j*(K-1)-1,K-2))%md;
		}
	printf("%d",f[n][n]);
	return 0;
}


Measured memory_bytes: 62720
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int main(){
    int a,b,c;cin >> a >> b >> c;
    cout << (a+b+c>=22?"bust":"win") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  
  cin >> N >> A >> B  ;
 
  if ( N*A <= B ) {
    cout << N*A << endl;
  }
  
  else  {
    cout <<  B  << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;

int main() {
  char s[int(pow(10, 5))];
  cin >> s;

  int num_zero = 0, num_one = 0, num_deleted_block;
  int i = 0;
  while(s[i]) {
    s[i] == '0' ? num_zero++ : num_one++;
    i++;
  }

  num_deleted_block = (num_zero < num_one ? num_zero : num_one)*2;
  cout << num_deleted_block << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define ll long long
#define endl '\n'
int main()
{
    IOS;  
    ll n;
    cin>>n;
    vector<ll> v(n);
    for(ll i=0;i<n;i++)
        cin>>v[i];
    vector<ll> cu(n);
    cu[0]=v[0];
    for(ll i=1;i<n;i++)
        cu[i]=cu[i-1]+v[i];

    sort(cu.begin(),cu.end());
    ll ans=0;
    for(ll i=0;i<n;)
    {
        ll ind=i;
        ll count=0;
        while(i<n&&cu[i]==cu[ind])
        {
            i++;
            count++;
        }
        if(cu[ind]==0)
        {
            ans+=count;
        }
        //trace3(count,cu[ind],ans);
        ll temp=count*(count-1);
        ans+=temp/2;
    }
    cout<<ans;
}

Measured memory_bytes: 3328
#define _CRT_SECURE_NO_DEPRECATE  
#define _CRT_NONSTDC_NO_DEPRECATE

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cctype>
#include <numeric>
#include <cstring>
#include <bitset>
#include <complex>
#include <complex>

using namespace std;

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){
    //os << "{ ";
    for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it)
        os << "" << *it << "" << (it + 1 == v.end() ? "" : " ");
    //os << " }";
    return os;
}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long ul;
typedef unsigned long long ull;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(ull i=(a); i<(ull)(b); i++)
#define rep(i,b) loop(i,0,b)
#define iter(i,c) for(auto it=c.begin(); it!=c.end(); ++it)
#define pb push_back
#define mp make_pair
string const resstr[] = { "Impossible", "Possible", "No", "Yes" };

int main(){
    int msize = 0;
    string s;
    set<string> dic;
    map<string, int> ss;
    while (1){
        string in; 
        if (!(cin >> in)) break;
        dic.insert(in);
        ss[in]++;
        if (msize < in.size()){
            s = in;
            msize = s.size();
        }
    }
    string a = s;
    int f = 0;
    iter(it,dic){
        if (f < ss[*it]){
            f = ss[*it];
            s = *it;
        }
    }
    cout << s << " " << a << endl;
}

Measured memory_bytes: 1200
#include <iostream>
#include <string>
using namespace std;
int n;
int a;
int Min,Max;
int main() {
    Min=1000000000;
    Max=0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a<Min){
            Min=a;
        }
        if(a>Max){
            Max=a;
        }
    }
    cout<<Max-Min<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <functional>
#include <iomanip>

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

// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
const int MOD = 1e9+7;
const int INF = 1e9;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

// debug
template<class T>ostream& operator<<(ostream& os, vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& out,const pair<T1,T2>& rhs){out<<"("<<rhs.first<<", "<<rhs.second<<")";return out;}
#include<type_traits>
template<typename T,size_t SIZE,enable_if_t<!is_same<remove_cv_t<T>,char>::value,nullptr_t> = nullptr>ostream& operator<<(ostream& os,T(&arr)[SIZE]){os<<"{";for(size_t i=0;i<SIZE;++i)os<<(i?", ":"")<<arr[i];os<<"}";return os;}
#ifdef LOCAL
    #define debug(v) cerr<<v<<"\n"
#else
    #define debug(...) 42
#endif


int main() {
  int N, K; cin >> N >> K;

  vi H(N);
  rep(i, N) {
    cin >> H[i];
  }
  sort(H.begin(), H.end());
  reverse(H.begin(), H.end());
  rep(i, min(N, K)) {
    H[i] = 0;
  }
  ll ans = 0;
  rep(i, N) ans += H[i];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        int a = sc.nextInt(), b = sc.nextInt();
                        System.out.printf("%d %d %.5f\n", a / b, a % b, (double)a / (double)b);
                }
        }
}


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

typedef long long int ll;

int main(){
   int table[3][3];
   for(int i = 0;i < 3;i++){
      for(int j = 0;j < 3;j++){
         cin >> table[i][j];
      }
   }
   bool frag = 1;
   int a = 0;
   for(int i = 0;i < 2;i++){
      if(table[i][1] - table[i][0] == table[i+1][1] - table[i+1][0]){
         a++;
      }else{
         frag = 0;
      }
      if(table[i][2] - table[i][1] == table[i+1][2] - table[i+1][1]){
         a++;
      }else{
         frag = 0;
      }
   }
   for(int i = 0;i < 2;i++){
     if(table[1][i] - table[0][i] == table[1][i+1] - table[0][i+1]){
         a++;
      }else{
         frag = 0;
      }
      if(table[2][i] - table[1][i] == table[2][i+1] - table[1][i+1]){
         a++;
      }else{
         frag = 0;
      }
   }
   if(frag){
      cout << "Yes" << endl;
   }else{
      cout << "No" << endl;
   }
}

Measured memory_bytes: 256
program main
  implicit none
  integer(8) i,N,Np,Nn,ip,in
  integer(8),allocatable :: A(:),pos(:),neg(:)
  read(*, *) N
  allocate(A(N))
  read(*, *) (A(i), i = 1,N)
  !正の数と負の数のカウントを行います。
  Np = 0
  Nn = 0
  do i = 1,N
    if (A(i) < 0) then
      Nn = Nn + 1
    else
      Np = Np + 1
    end if
  end do
  if (Nn == 0) then
    allocate(pos(N-1))
    allocate(neg(1))
    neg(1) = A(1)
    do i = 2,N
      if (A(i) <neg(1)) then
        pos(i-1) = neg(1)
        neg(1) = A(i)
      else
        pos(i-1) = A(i)
      end if
    end do
    write (*,*) sum(pos) -neg(1)
    do i = 1,N-2
      write(*, *) neg(1),pos(i)
      neg(1) = neg(1)-pos(i)
    end do
    write(*, *) pos(N-1),neg(1)

    
  else if (Np == 0) then
    allocate(pos(N))
    allocate(neg(N-1))
    pos(1) = A(1)
    do i = 2,N
      if (A(i) > pos(1)) then
        neg(i-1) = pos(1)
        pos(1) = A(i)
      else
        neg(i-1) = A(i)
      end if
    end do
    write (*,*) pos(1)-sum(neg) 
    do i = 1,N-1
      write(*, *) pos(1),neg(i)
      pos(1) = pos(1)-neg(i)
    end do

    
  else
    allocate(pos(Np))
    allocate(neg(Nn))
    ip = 1
    in = 1
    do i = 1,N
      if (A(i) < 0) then
        neg(in) = A(i)
        in = in + 1
      else
        pos(ip) = A(i)
        ip = ip + 1
      end if
    end do
    write(*, *) sum(pos)-sum(neg)
    if (Np > 1) then
      do i = 2,Np
        write(*, *) neg(1),pos(i)
        neg(1)=neg(1)-pos(i)
      end do
    end if
    if (Nn > 1) then
      do i = 2,Nn
        write(*, *) pos(1),neg(i)
        pos(1)=pos(1)-neg(i)
      end do
    end if
    write(*,*) pos(1),neg(1)
  end if
end program main


Measured memory_bytes: 6528
def tax(rate,price)
  (price*(100+rate)/100.0).floor
end

while true
  x,y,s = gets.split(" ").map{|str| str.to_i}
  break if x==0 && y==0 && s==0

  maxprice = 0
  for i in 1..s-1 #??????1????¨??????????
    for j in 1..s-1
      if tax(x,i)+tax(x,j) == s
        price = tax(y,i)+tax(y,j)
        maxprice = price if price > maxprice
      end
    end
  end

  puts maxprice
end

Measured memory_bytes: 8768
#include <iostream>
#include <string>
using namespace std;
int main(){
 int n;
 string s;
 cin>>n>>s;
 int ans = 0;
 int cnt = 0;
 string x,y;
 for(int i=1;i<n;i++){
   cnt = 0;
   x = s.substr(0,i);
   y = s.substr(i,n-i);
   for(int j=0;j<26;j++){
     if(x.find('a'+j)!=-1&&y.find('a'+j)!=-1)cnt++;
   }
   ans = max(ans,cnt);
 }
  cout << ans << endl;
 return 0; 
}

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

void saiki(vector<int>& z,int ma,int nk){
if(nk==0) {
for(int i=0;i<z.size()-1;i++) cout<<z[i]<<" ";
cout<<z[z.size()-1]<<endl;
}
else if(ma*nk!=0){
for(int i=min(ma,nk);i>0;i--){
z.push_back(i);
	saiki(z,i,nk-i);
	z.pop_back();
}
	
	
	
	
}
}	


int main() {
	
	int n;
	while(cin>>n){
if (n==0 )break;	
	vector<int> z;
	
//	cin>>n;
for(int i=n;i>0;i--){
z.push_back(i);
	saiki(z,i,n-i);
z.pop_back();
	
}
	
}
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    int linexSum[n];
    int linepSum[n];
    int kaburi[n];
    for(int i=0;i<n;i++){
        linexSum[i]=1;
    }
    for(int i=0;i<n;i++){
        linepSum[i]=0;
    }
    for(int i=0;i<n;i++){
        kaburi[i]=0;
    }
    
    int p[n][3];
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>p[i][j];
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            linexSum[i]*= p[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            linepSum[i]+= p[i][j];
        }
    }

    int ans=0;
        
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(linexSum[i]!=0 && linexSum[i]==linexSum[j] && linepSum[i]==linepSum[j]){
                kaburi[i]++;
                linexSum[j]=0;
                linepSum[j]=0;
            }
        }
    }

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

    cout<<ans<<endl;

    return 0;
}



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

int main() {
	int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<int>l(Q);
	vector<int>r(Q);
	for (int i = 0; i < Q; i++)cin >> l[i] >> r[i];
	vector<int> cnt(N);
	cnt[0] = 0;
	for (int i = 1; i < N; i++) {
		if (S[i - 1] == 'A' && S[i] == 'C')cnt[i]++;
		cnt[i] += cnt[i - 1];
	}
	for (int i = 0; i < Q; i++) {
		cout << cnt[r[i]-1] - cnt[l[i]-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 2176
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::usize::MAX;

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)*}};}
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)*}};}
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:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        a: usize,
        b: usize
    }

    let seqs = n / (a + b);

    let rest_a = if (n - (a + b) * seqs) <= a {
        (n - (a + b) * seqs)
    } else {
        a
    };

    println!("{}", seqs * a + rest_a);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 8572
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,c) memset(a,c,sizeof(a))

#define DEBUG(x) cout<<"#x"<<": "<<x<<endl

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = INT_MAX/3;
const ll MOD = 1000000007;
const double EPS = 1e-14;
const int dx[] = {1,0,-1,0} , dy[] = {0,1,0,-1};

map<int,bool> used;
map<int,int> count_t;
map<int,bool> isDecided;

int main(){
    while(true){
	int n;
	vector< pair< pair<int,int> , pair<int,int> > > t;
	cin >> n;
	if(n==0) break;
	used.clear();
	count_t.clear();
	isDecided.clear();
	REP(i,n){
	    int I,A,U,P;
	    cin >> I >> U >> A >> P;
	    t.PB( MP( MP(-A,P) , MP(I,U) ) );
	    used[I] = false;
	    count_t[U] = false;
	    isDecided[I] = false;
	}
	sort(ALL(t));
// 	REP(i,n) printf("A: %d P: %d I: %d U: %d\n",-t[i].first.first,t[i].first.second,t[i].second.first,t[i].second.second);
	int temp = 0;
//
// 	REP(i,n){
// 	    if(!used[t[i].second.second]){
// 		used[t[i].second.second] = true;
// 		count_t[t[i].second.second]++;
// 		isDecided[t[i].second.first] = true;
// 		temp++;
// 	    }
// 	}

	if(temp < 10){
	    REP(i,n){
		if(!isDecided[t[i].second.first] && count_t[t[i].second.second] < 3){
		    count_t[t[i].second.second]++;
		    isDecided[t[i].second.first] = true;
		    temp++;
		}
		if(temp == 10) break;
	    }
	}


	if(temp < 20){
	    REP(i,n){
		if(!isDecided[t[i].second.first] && count_t[t[i].second.second] < 2){
		    count_t[t[i].second.second]++;
		    isDecided[t[i].second.first] = true;
			temp++;
		}
		if(temp == 20) break;
	    }
	}

	if(temp < 26){
	    REP(i,n){
		if(!isDecided[t[i].second.first] && count_t[t[i].second.second] < 1){
		    count_t[t[i].second.second]++;
		    isDecided[t[i].second.first] = true;
		    temp++;
		}
		if(temp == 26) break;
	    }
	}

	REP(i,n){
	    if(isDecided[t[i].second.first]) cout << t[i].second.first << endl;
	}
    }

    return 0;
}

Measured memory_bytes: 1224
import itertools

bells = [[], [[0]]] + [None for i in range(9)]
bell_n = [1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, 115975]

def search(n):
    ret = []
    ret.append( [ 0 for _ in range(n) ] )
    for k in range(1,n):
        for bi in bells[k]:
            for ids in itertools.combinations(range(1,n), k):
                st = [0 for _ in range(n)]
                for i, id in enumerate(ids):
                    st[id] = bi[i] + 1
                ret.append(st)
    return ret

for i in range(2, 11):
    bells[i] = search(i)
    assert bell_n[i] == len(bells[i])

N = int(input())
table = "abcdefghij"
outs = []
for bi in bells[N]:
    out = ""
    for b in bi:
        out += table[b]
    outs.append(out)

print("\n".join(sorted(outs)))



Measured memory_bytes: 44988
#!/usr/bin/env python3
from itertools import accumulate

N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
INF = 10**18
ans = - INF
used = [0] * N
candidate = []

for i in range(N):
    if used[i]: continue
    now = i
    used[i] = 1
    tmp = [i]
    
    while P[now]-1 not in tmp:
        used[P[now]-1] = 1
        tmp.append(P[now]-1)
        now = P[now]-1

    candidate.append(tmp)

for tmp in candidate:
    M = len(tmp)
    accumT = []
    for t in tmp:
        accumT.append(C[t])
    loop = 3
    accumT = [0] + list(accumulate(accumT*loop))
    res = - INF

    if K <= M:
        for i in range(loop*M+1):
            for j in range(i+1,loop*M+1):
                if j-i > K:
                    break
                res = max(res,accumT[j]-accumT[i])
        ans = max(ans,res)
    else:
        SUM = accumT[M]
        if SUM > 0:
            addition = SUM * (K//M - 1)# K//M回回らない方がいい場合がある
            for i in range(loop*M+1):
                for j in range(i+1,loop*M+1):
                    if j-i > K%M+M:
                        break
                    res = max(res,accumT[j]-accumT[i])
            ans = max(ans,res+addition)
        else:
            for i in range(loop*M+1):
                for j in range(i+1,loop*M+1):
                    if j-i > M:
                        break
                    res = max(res,accumT[j]-accumT[i])
            ans = max(ans,res)
print(ans)

Measured memory_bytes: 74812
// C - XYZ Triplets

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	unordered_map<int, int> ans;

	for (int x=1; x*x<N; x++) {
		for (int y=1; x*x + y*y < N; y++) {
			for (int z=1; x*x + y*y + z*z < N; z++) {
				ans[x*x + y*y + z*z + x*y + y*z + z*x]++;
			}
		}
	}

	for (int i=1; i<=N; i++) {
		cout << ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 4220