akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=2e5+5;
int n,X,Y,hd1[maxn],k1,hd2[maxn],k2,dep[maxn],p[maxn][21],tis[maxn];
int ans=0;
struct edd{
	int nt,v;
}e1[maxn*2],e2[maxn*2];

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

inline void add1(int a,int b){
	e1[k1].v=b; e1[k1].nt=hd1[a]; hd1[a]=k1++;
	e1[k1].v=a; e1[k1].nt=hd1[b]; hd1[b]=k1++;
}

inline void add2(int a,int b){
	e2[k2].v=b; e2[k2].nt=hd2[a]; hd2[a]=k2++;
	e2[k2].v=a; e2[k2].nt=hd2[b]; hd2[b]=k2++;
}

inline void dfs(int x,int fa){
	p[x][0]=fa; dep[x]=dep[fa]+1;
	for(rg int i=hd2[x];i!=-1;i=e2[i].nt){
		int v=e2[i].v; if(v == fa) continue;
		dfs(v,x);
	}
}

void pre(){
	go(j,20,1)
		go(i,n+1,1) p[i][j]=p[p[i][j-1]][j-1];
}

inline int lca(int x,int y){
	if(dep[x] > dep[y]) swap(x,y);
	for(rg int j=19;j>=0;j--){
		if(dep[p[y][j]] < dep[x]) continue;
		y=p[y][j];
	}
	for(rg int j=19;j>=0;j--){
		if(p[x][j] == p[y][j]) continue;
		x=p[x][j]; y=p[y][j];
	}
	return x == y ? x : p[x][0];
}

inline int dis(int x,int y){
	int d=lca(x,y);
	return dep[x]+dep[y]-dep[d]*2;
}

void walk(int x,int fa){
	tis[x]=tis[fa]+1;
	if(dep[x] < tis[x]) return ;
	if(ans != -1) ans=max(ans,dep[x]);
	if(dep[x] == tis[x]) return ;
	for(rg int i=hd1[x];i!=-1;i=e1[i].nt){
		int v=e1[i].v; if(v == fa) continue;
		if(dis(x,v) >= 3){
			ans=-1; return ;
		}
		walk(v,x);
		if(ans == -1) return ;
	}
}

int main(){
	#ifndef ONLINE_JUDGE
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	#endif
	memset(hd1,-1,sizeof(hd1)); k1=0;
	memset(hd2,-1,sizeof(hd2)); k2=0;
	n=rd(); X=rd(); Y=rd(); int a,b;
	go(i,n,1){ a=rd(); b=rd(); add1(a,b); }
	go(i,n,1){ a=rd(); b=rd(); add2(a,b); }
	dep[0]=-1; dfs(Y,0); pre();
	tis[0]=-1; walk(X,0);
	printf("%d",ans == -1 ? -1 : ans*2);
	return 0;
}//Faze


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

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int , int>;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
}

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

  int n; cin >> n;
  int a[n]; rep(i, n) cin >> a[i];
  int ans = a[0];
  rep(i, n-1) {
    ans = gcd(ans, a[i+1]);
  }
  cout << ans;
}


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

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define INF             2e16
#define ff              first
#define sf              scanf
#define pf              printf
#define ss              second
#define mk              make_pair
#define pb              push_back
#define PI              acos(-1.0)
#define nl              printf("\n")

#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())

#define sz              100005
#define ll              long long
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0);

bool flag=true;
vector < int > v;



void init(int n){
   int i,j;
   for(i=0; i<=n; i++){

   }
}

int main(){

     ll int  ans =0,sum=0,temp;
     ll int a,b,c, i,j,k, n,m,t,q, x=0,y=0,z=0, index, id,mn=INF;
     cin>>n;
     for(i=0; i<n; i++){
        cin>>a;
        ans+=(a-1);
     }
     cout<<ans<<endl;



    return 0;

}




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

long long gcd(long long a, long long b){
    int c = 0;
    c = a%b;
    if(c == 0){
        return b;
    }
    gcd(b,c);
}

int main(){
    long long ans = 0;
    long long A,B;
    cin >> A >> B;

    ans = gcd(A,B);
    ans = A*B/ans;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int main(){

    int N,A[60]={},B[60]={},C[60]={},ans=0;
    cin>>N;

    for(int i=1;i<=N;i++){
        cin>>A[i];
    }
    for(int i=1;i<=N;i++){
        cin>>B[i];
        ans+=B[i];
    }
    for(int i=1;i<=(N-1);i++){
        cin>>C[i];
    }

    for(int i=1;i<=(N-1);i++){
        if((A[i]+1)==A[i+1]){
            ans+=C[A[i]];
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;	// 998244353
using ll = long long;
using namespace std;

struct query{
	int vert;
	int dist;
	int col;
};

vector<int> graph[100010];
vector<query> ql;
// farbe[v] := 頂点 v は何色か？（初期値 0）
int farbe[100010];
// dmax[v] := 頂点 v から距離いくつまでのノードが塗られているか？
int dmax[100010];

void init(){
	for( int i = 0; i < 100010; ++i ) dmax[i] = -1;
}

void dfs( int v, int d, int c ){
	if( dmax[v] >= d ) return;
	dmax[v] = d;
	if( farbe[v] == 0 ) farbe[v] = c;
	for( auto next : graph[v] ){
		dfs( next, d-1, c );
	} 
}

int main(){
	init();
	int n, m; cin >> n >> m;
	for( int i = 0; i < m; ++i ){
		int a, b; cin >> a >> b; --a; --b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	int qnum; cin >> qnum;
	for( int i = 0; i < qnum; ++i ){
		int vt, dt, ct; cin >> vt >> dt >> ct; --vt;
		ql.push_back((query){vt, dt, ct});
	}
	reverse( ql.begin(), ql.end() );
	for( int i = 0; i < qnum; ++i ){
		dfs( ql[i].vert, ql[i].dist, ql[i].col );
	}
	for( int i = 0; i < n; ++i ){
		cout << farbe[i] << endl;
	}
}

Measured memory_bytes: 8816
using System;
class Program
{
	static void Main(string[] args)
	{
      // インプット
      string[] input = Console.ReadLine().Split( ' ' );
      int n = int.Parse( input[0] );
      int k = int.Parse( input[1] );
      int q = int.Parse( input[2] );

      int[] a = new int[q];
      for( int i = 0; i < a.Length; i++ )
      {
        a[i] = int.Parse( Console.ReadLine() );
      }
      
      // アウトプット
      int[] n2 = new int[n];
      for( int i = 0; i < a.Length; i++ )
      {
        n2[a[i] - 1 ]++; 
      }
      
      for( int i = 0; i < n2.Length; i++ )
      {
        if(n2[i] > (q - k) )
        {
          Console.WriteLine("Yes");
        }
        else
        {
          Console.WriteLine("No");
        }
      }
   	}
}

Measured memory_bytes: 15964
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        List<String> list = new ArrayList<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        while(true) {
            String line = br.readLine();
            if(line.equals("-")){
                list.add(sb.toString());
                break;
            }
            if(!isNumber(line)){
                list.add(sb.toString());
                sb = new StringBuilder(line);
                String foo = br.readLine();//消化
                continue;
            }
            int sub = Integer.parseInt(line);
            String tmp = sb.substring(0,sub);
            sb = sb.delete(0,sub);
            sb.append(tmp);
        }
        list.remove(0);
        for(String s:list) 
            System.out.println(s);
    }
    static boolean isNumber(String val) {
    	try {
    		Integer.parseInt(val);
    		return true;
    	} catch (NumberFormatException nfex) {
    		return false;
    	}
    }
}

Measured memory_bytes: 16896
#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
long long int lcm(long long int a, long long int b)
{
   return a * b / gcd(a, b);
}
int main(){
	long long int a;
	long long int b,n;
	cin >> a >> b >> n;
	long long int l=lcm(a,b);
	long long int k=l-1;
	long long int p= (a*k)/b;
	long long int q=k/b;
	if(n>=l){
		cout << p-a*q << endl;
	}
	else if(n<l&&n/b>0){
		long long int r=n/b;
		long long int s=r*b-1;
		long long int c=(a*s)/b;
		long long int d=s/b;
		cout << c-a*d << endl;
		}
	else{
	    cout << (a*n)/b << endl;
	}

	

}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    LL k;
    cin >> s >> k;
    k--;
    LL i = 0;
    while(i < k) {
        if(s[i]=='1') i++;
        else break;
    }

    cout << s[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
int main(void)
{
    char s[100000]={};
    scanf("%s",s);
    int a[100000]={};
    int count=0;
    int p=0;
    int po=0;
    char c=s[0];
    int len=strlen(s);
    //printf("%d",len);
    while(po<len)
    {
        if(c==s[po])
        {
            count++;
            po++;
        }
        else
        {
            a[p]=count;
            p++;
            count=1;
            c=s[po];
            po++;
        }
    }
    a[p]=count;
    int leng=0;
    while(a[leng]!=NULL)leng++;
    //printf("%d\n",leng);
    int minki=111111;
    int mingu=111111;
    int rightsum=0;
    int leftsum=0;
    for(int pp=0;pp<leng;pp+=2)
    {
        rightsum=0;
        leftsum=0;
        for(int q=pp+1;q<leng;q++)rightsum+=a[q];
        for(int r=pp-1;r>=0;r--)leftsum+=a[r];
        if(minki>rightsum && rightsum>=leftsum)minki=rightsum;
        if(minki>leftsum&&rightsum<=leftsum)minki=leftsum;
    }
    for(int ss=1;ss<leng;ss+=2)
    {
        rightsum=0;
        leftsum=0;
        for(int t=ss+1;t<leng;t++)rightsum+=a[t];
        for(int u=ss-1;u>=0;u--)leftsum+=a[u];
        if(mingu>rightsum&& rightsum>=leftsum)mingu=rightsum;
        if(mingu>leftsum&&rightsum<=leftsum)mingu=leftsum;
    }
    //printf("%d%d",minki,mingu);
    if(a[1]==0)printf("%d",len);
    else if(mingu>minki)printf("%d",mingu);
    else printf("%d",minki);
}


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

using namespace std;

int dp[100010][3],a[4];
int main(){
	int N,most=-1;
	scanf("%d",&N);
	
	for(int i=1;i<=N;i++){
		
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		int p=a+max(dp[i-1][2],dp[i-1][3]);
		int q=b+max(dp[i-1][1],dp[i-1][3]);
		int r=c+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=p;
		dp[i][2]=q;
		dp[i][3]=r;
	}
	a[0]=dp[N][1]; a[1]=dp[N][2]; a[2]=dp[N][3];
	sort(a,a+3);
	printf("%d\n",a[2]);
	return 0;
}

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

struct Point {double x, y;};
struct Square {double left, right, top, bottom;};

bool include(const Square& s, const Point& p) {
  return s.left <= p.x && p.x <= s.right && s.bottom <= p.y && p.y <= s.top;
}

bool ok(const vector<Point>& point, double d) {
  Square A = {point.front().x, point.front().x + d, 0, 0};
  Square B = {point.back().x - d, point.back().x, 0, 0};
  double lowA = 1e9, highA = -1e9;
  double lowB = 1e9, highB = -1e9;
  for(const auto& p: point) {
    if(p.x <= A.right) {
      lowA = std::min(lowA, p.y);
      highA = std::max(highA, p.y);
    }
    if(B.left <= p.x) {
      lowB = std::min(lowB, p.y);
      highB = std::max(highB, p.y);
    }
  }
  A.top = highA;    A.bottom = highA - d;
  B.top = lowB + d; B.bottom = lowB;
  if(all_of(begin(point), end(point), [&](const Point& p){return include(A, p) || include(B, p);})) return true;
  A.top = lowA + d; A.bottom = lowA;
  B.top = highB;    B.bottom = highB - d;
  if(all_of(begin(point), end(point), [&](const Point& p){return include(A, p) || include(B, p);})) return true;
  return false;
}

int main() {
  int N;
  cin >> N;
  vector<Point> point(N);
  for(auto& p: point) cin >> p.x >> p.y;
  for(auto& p: point) p = {p.x / sqrt(2) - p.y / sqrt(2), p.x / sqrt(2) + p.y / sqrt(2)};
  sort(begin(point), end(point), [](const Point& lhs, const Point& rhs){return lhs.x < rhs.x;});
  double low = -3e5, high = 3e5;
  while(1e-3 < high - low) {
    double middle = (low + high) / 2.0;
    ok(point, middle) ? (high = middle) : (low = middle);
  }
  cout << int(high * sqrt(2)) << endl;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    ll N, Q;
    cin >> N >> Q;

    ll ans = (N-2) * (N-2);
    map<int, int> ver, hor;
    for (int i=0; i<Q; ++i) {
        int n, x;
        cin >> n >> x;
        if (n == 1) {
            auto iter = ver.upper_bound(x);
            int len = (iter == ver.end() ? N : iter->second);
            ans -= len - 2;
            auto iter2 = hor.lower_bound(len);
            if (iter2 == hor.end() || iter2->second > x) hor[len] = x;
        } else {
            auto iter = hor.upper_bound(x);
            int len = (iter == hor.end() ? N : iter->second);
            ans -= len - 2;
            auto iter2 = ver.lower_bound(len);
            if (iter2 == ver.end() || iter2->second > x) ver[len] = x;
        }
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


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

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { for (auto& _e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

int main(void) {
	int N;
	cin >> N;
	vec<pair<int, int>> BA(N);
	for (int i = 0; i < N; ++i) {
		int A, B;
		cin >> A >> B;
		BA[i] = { B, A };
	}
	sort(ALL(BA));
	ll t = 0;
	for (int i = 0; i < N; ++i) {
		t += BA[i].second;
		if (t > BA[i].first) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int main()
{
	int n,sc;
	cin>>n>>sc;
	if(n<10)sc+=100*(10-n);
	cout<<sc<<endl; 
	return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include<iostream>

int main() {
	int dishs[5];
	int dishs_loss[5] = { 0 };
	int min_index = 0;
	int min = 256;
	for (int i = 0; i < 5; i++) {
		int N = 0;
		scanf("%d", &N);
		dishs[i] = N;
		dishs_loss[i] = 10 - dishs[i] % 10;
		if (dishs_loss[i] == 10)dishs_loss[i] = 0;
		if (dishs_loss[i] < min) {
			min_index = i;
			min = dishs_loss[i];
		}
	}


	int total = 0;
	for (int i = 0; i < 5; i++) {
		total += dishs[min_index];
		if (i != 4) {
			int loss = 10 - (total % 10);
			if (loss == 10)loss = 0;
			total += loss;
		}
		dishs_loss[min_index] = -1;
		min = 256;
		for (int j = 0; j < 5; j++) {
			if (dishs_loss[j] < min && dishs_loss[j] >= 0) {
				min_index = j;
				min = dishs_loss[j];
			}
		}
	}
	std::cout << total << std::endl;
	scanf("%d", &total);
}



Measured memory_bytes: 256
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n, b, c;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c;
    cin >> c;
    int i=int(c)+1;
    cout << char(i) << "\n";
}



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int H,A,m,n;
  scanf("%d %d",&H,&A);
  m = H / A;
  n = H % A;
  if (n > 0)
  {
    printf("%d",m+1);
    return(0);
  }
  printf("%d",m);
}

Measured memory_bytes: 128
#include <stdio.h>
int main(){
  int l1,l2,l3;
  int t=0,h=0;
  while(scanf("%d,%d,%d",&l1,&l2,&l3)!=EOF){
    if(l1*l1+l2*l2==l3*l3)t++;
    else {
      if(l1==l2)h++;
    }
  }
  printf("%d\n%d\n",t,h);
  return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    ll N, ans = 0;
    cin >> N;
    for(ll i = 1; i < N; i++){
        ll j = N - i;
        if(i < j)ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,sum;
  cin>>N;
  string S[N],H[4];
  for(int i=0;i<N;i++){
   cin>>S[i];
  }
  H[0]="P";
  H[1]="W";
  H[2]="G";
  H[3]="Y";
  int s[4];
  s[0]=0;
  s[1]=0;
  s[2]=0;
  s[3]=0;
  for(int j=0;j<4;j++){
  for(int i=0;i<N;i++){
   if(H[j]==S[i]){
    s[j]=1;
   }
  }
  }
  sum=s[0]+s[1]+s[2]+s[3];
  if(sum==4){
   cout<<"Four"<<endl;
  }
  if(sum==3){
   cout<<"Three"<<endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<queue>
#include<algorithm>
using namespace std;
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
char L[50][51];
char R[50][51];
struct wolf{
	int ax,ay,bx,by;
};
int bfs[50][50][50][50];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		for(int i=0;i<b;i++){
			scanf("%s%s",L[i],R[i]);
		}
		for(int i=0;i<b;i++)
			for(int j=0;j<a;j++)
				for(int k=0;k<b;k++)
					for(int l=0;l<a;l++)
						bfs[i][j][k][l]=0;
		queue<wolf>Q;
		wolf S;
		for(int i=0;i<b;i++)
			for(int j=0;j<a;j++){
				if(L[i][j]=='L'){
					S.ax=i;
					S.ay=j;
				}
				if(R[i][j]=='R'){
					S.bx=i;
					S.by=j;
				}
			}
		bfs[S.ax][S.ay][S.bx][S.by]=1;
		Q.push(S);
		while(Q.size()){
			wolf at=Q.front();
			Q.pop();
			for(int i=0;i<4;i++){
				wolf to=at;
				to.ax+=dx[i];
				to.ay+=dy[i];
				to.bx+=dx[i];
				to.by-=dy[i];
				//printf("%d %d %d %d\n",to.ax,to.ay,to.bx,to.by);
				bool okL=true;
				bool okR=true;
				if(0>to.ax||b<=to.ax)okL=false;
				if(0>to.bx||b<=to.bx)okR=false;
				if(0>to.ay||a<=to.ay)okL=false;
				if(0>to.by||a<=to.by)okR=false;
				if(okL&&L[to.ax][to.ay]=='#')okL=false;
				if(okR&&R[to.bx][to.by]=='#')okR=false;
				if(!okL){
					to.ax-=dx[i];
					to.ay-=dy[i];
				}
				if(!okR){
					to.bx-=dx[i];
					to.by+=dy[i];
				}
				//printf("%d %d %d %d\n\n",to.ax,to.ay,to.bx,to.by);
				if(!bfs[to.ax][to.ay][to.bx][to.by]&&((L[to.ax][to.ay]=='%'&&R[to.bx][to.by]=='%')||(L[to.ax][to.ay]!='%'&&R[to.bx][to.by]!='%'))){
					bfs[to.ax][to.ay][to.bx][to.by]=1;
					Q.push(to);
				}
			}
		}
		wolf G;
		for(int i=0;i<b;i++)
			for(int j=0;j<a;j++){
				if(L[i][j]=='%'){
					G.ax=i;
					G.ay=j;
				}
				if(R[i][j]=='%'){
					G.bx=i;
					G.by=j;
				}
			}
		if(bfs[G.ax][G.ay][G.bx][G.by])printf("Yes\n");
		else printf("No\n");
	}
}

Measured memory_bytes: 26380
#include<stdio.h>
int main()
{
  int a[1000000],c=0,i,b[100000],j,k;
  while(1){
    scanf("%d",&a[c]);
    if(a[c]==-1)
      break;
    c++;
  }
  for(i=0;i<c;i++){
    if(a[i]<4)
      printf("%d\n",a[i]);
    else{
    j=0;
    while(1){
      b[j]=a[i]%4;
      a[i]=a[i]/4;
      j++;
      if(a[i]<4){
	b[j]=a[i];
	break;
      }
    }
    for(k=j;k>=0;k--)
      printf("%d",b[k]);
    printf("\n");
    }
  }
  return 0;
}

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

using namespace std;

struct Tree {
    vector<long long> distances;
    vector<vector<pair<int, int> > > edges;

    explicit Tree(int n) {
        distances.resize(n + 1, -1);
        edges.resize(n + 1);
    }

    void connect(int a, int b, int dist) {
        edges[a].emplace_back(b, dist);
        edges[b].emplace_back(a, dist);
    }

    void bfs(int root) {
        distances[root] = 0;
        queue<int> current;
        current.push(root);
        while (!current.empty()) {
            int a = current.front();
            for (int i = 0; i < edges[a].size(); ++i) {
                int b = edges[a][i].first, c = edges[a][i].second;
                if (distances[b] == -1) {
                    distances[b] = distances[a] + c;
                    current.push(b);
                }
            }
            current.pop();
        }
    }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    auto tree = Tree(N);
    for (int i = 0; i < N - 1; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        tree.connect(a, b, c);
    }
    int Q, K;
    cin >> Q >> K;
    vector<pair<int, int> > XY(Q);
    for (auto & xy : XY) cin >> xy.first >> xy.second;
    tree.bfs(K);
    for (auto & xy : XY) {
       printf("%lld\n", tree.distances[xy.first]+tree.distances[xy.second]);
    }
    return 0;
}


Measured memory_bytes: 9588
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int n,x;
  cin>>n>>x;
  int min=100000;
  rep(i,n){
    int m;
    cin>>m;
    if(min>m) min=m;
    x-=m;
  }
  cout<<n+x/min<<endl;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=75;
const int mod=1e9+7;
int n,k;
char s[maxn];
int nxt[maxn][2],pos0[maxn],pos1[maxn],lim[maxn],fac[maxn*2],ifac[maxn*2];
int dp[maxn][maxn][maxn];
bool del[maxn];
void Add(int &a,int b){
	a+=b;
	if(a>=mod)a-=mod;
}
int C(int a,int b){
	if(a<b||a<0||b<0)return 0;
	return 1LL*fac[a]*ifac[b]%mod*ifac[a-b]%mod;
}

int main(){
	scanf("%d%d%s",&n,&k,s);
	fac[0]=fac[1]=ifac[0]=ifac[1]=1;
	for(int i=2;i<=2*max(n,k);i++){
		fac[i]=1LL*fac[i-1]*i%mod;
		ifac[i]=1LL*ifac[mod%i]*(mod-mod/i)%mod;
	}
	REP(i,2*max(n,k))ifac[i]=1LL*ifac[i-1]*ifac[i]%mod;
	nxt[k][0]=nxt[k][1]=k;
	for(int i=k-1;i>=0;i--){
		if(s[i]=='r')nxt[i][0]=i,nxt[i][1]=nxt[i+1][1];
		else nxt[i][0]=nxt[i+1][0],nxt[i][1]=i;
	}
	int ans=0;
	rep(i,k+1)rep(s,k+1){
		bool ok=true;
		int last0=-1,last1=-1;
		rep(j,k)del[j]=false;
		rep(j,i){
			pos0[j]=nxt[last0+1][0];
			pos1[j]=nxt[max(last1+1,pos0[j])][1];
			if(pos0[j]==k||pos1[j]==k){
				ok=false;
				break;
			}
			del[pos0[j]]=del[pos1[j]]=true;
			last0=pos0[j];last1=pos1[j];
		}
		if(!ok)continue;
		int last=-1;
		rep(j,s){
			int cur0=nxt[last+1][0];
			while(cur0<k&&del[cur0])cur0=nxt[cur0+1][0];
			if(cur0==k){
				ok=false;
				break;
			}
			del[cur0]=true;
		}
		if(!ok)continue;
		rep(j,i){
			lim[i-j]=0;
			for(int p=pos1[j]+1;p<k;p++)if(!del[p])lim[i-j]++;
		}
		memset(dp,0,sizeof(dp));
		dp[0][0][0]=1;
		rep(j,i+1)rep(p,k+1)rep(q,k+1){
			int cur=dp[j][p][q];
			if(!cur)continue;
			rep(t,k+1){
				if(q+t*p>lim[j+t])break;
				Add(dp[j+t][p+1][q+t*p],1LL*cur*ifac[t]%mod);
			}
		}
		rep(q,k+1){
			int cur=dp[i][k][q];
			if(!cur)continue;
			int now=q*2+i;
			int coef=1LL*cur*fac[i+s]%mod*ifac[s]%mod;
			rep(p,n-s-now+1){
				int cur;
				if(now+2*i+s==0&&p==0)cur=1;
				else cur=1LL*C(p+(now+2*i+s-1),now+2*i+s-1)*C(n-s-now-p+1,i+s)%mod;
				Add(ans,1LL*coef*cur%mod);
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n, d, x;
  cin >> n >> d >> x;

  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    sum += 1 + (d - 1) / a;
  }

  cout << sum + x << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int a,b[1000],i=0,*str;

	scanf("%d",&a);
	while(i != a){
		scanf("%d",&b[i]);
		i++;
	}
	str = &b[i-1];
	while(str != &b[0]){
		printf("%d ",*str);
		str--;
	}
	printf("%d",b[0]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 604
H, W = gets.split.map(&:to_i)

if H == 1 || W == 1
  puts 1
  exit
end

ans = 0

if H.even?
  if W.even?
    ans += H * (W / 2)
  else
    ans += (H / 2) * ((W / 2) + 1)
    ans += (H / 2) * (W / 2)
  end
else
  if W.even?
    ans += ((H / 2) + 1) * (W / 2)
    ans += (H / 2) * (W / 2)
  else
    ans += ((H / 2) + 1) * ((W / 2) + 1)
    ans += (H / 2) * (W / 2)
  end
end

puts ans


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

int main() {
	
	string s; int  q; cin >> s >> q;
	bool standard = true;
	string right = "";
	string left = "";
	for (int i = 0; i < q; i++) {
		int t; cin >> t;		
		if (t == 2) {
			int f; char c; cin >> f >> c;
			string sc{ c };
			if (standard) {
				if (f == 1) {
					left = sc + left;
				}
				else { // t == 2
					right += sc;
				}
			}
			else {
				if (f == 1) {
					right += sc;
				}
				else { // t == 2
					left = sc + left;
				}
			}
		}
		else { // t == 1
			if (standard) standard = false;
			else standard = true;
		}
	}
	s = left + s;
	s += right;
	if (!standard) reverse(s.begin(), s.end());
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 1360
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <iomanip>
#include <sstream>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long ll;

int main() {
	int n; cin >> n;
	int s = n;
	int res = 0;
	while (s > 0) {
		res += s % 10;
		s /= 10;
	}
	cout << (n % res == 0 ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN,"%d",$n);
for($i=0;$i<$n;$i++){
	$a=0;
	$b=0;
	$f=0;
	fscanf(STDIN,"%d %d %d %d %d %d %d %d %d %d",$ar[0],$ar[1],$ar[2],$ar[3],$ar[4],$ar[5],$ar[6],$ar[7],$ar[8],$ar[9]);
	for($j=0;$j<10;$j++){
		if($ar[$j]>$a&&$ar[$j]>$b){
			if($a>$b)$a=$ar[$j];
			else $b=$ar[$j];
		}
		else if($ar[$j]>$a)$a=$ar[$j];
		else if($ar[$j]>$b)$b=$ar[$j];
		else $f=1;
	}
	if($f==1)print "NO\n";
	else print "YES\n";
}
?>

Measured memory_bytes: 6572
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(x) for(auto it=(x).begin();it!=(x).end();it++) 
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
 
using namespace std;

typedef struct UNIONFINDOOOO{
    vector<int> rank,par;
    
    void init(int n){
        rep(i,0,n){
            rank.pb(0);
            par.pb(i);
        }
    }
    
    int find(int x){
        if(par[x]==x)return x;
        else return par[x]=find(par[x]);
    }
    
    void unite(int x,int y){
        x=find(x);
        y=find(y);
        
        if(x==y)return ;
        if(rank[x]<rank[y]){
            par[x]=y;
        }else {
            par[y]=x;
            if(rank[x]==rank[y])rank[x]++;
        }
    }
}UF;

int main(){
    int n,q;
    cin>>n>>q;
    UF uf;
    uf.init(n);
    rep(i,0,q){
        int com,x,y;
        cin>>com>>x>>y;
        if(com==0)uf.unite(x,y);
        else {
            cout<<((uf.find(x)==uf.find(y))?1:0)<<endl;
        }
    }
    
    
    return 0;
}


Measured memory_bytes: 3244
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<string>
#include<set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<n; i++)

int H,N;
int A[10101],B[101010];
ll dp[20100];

void solve() {
	int i,j,k,l,r,x,y; string s;

	cin>>H>>N;
	rep(i,20001) dp[i]=1LL<<60;
	dp[0]=0;
	rep(i,N) {
		cin>>x>>y;
		rep(j,H) dp[j+x]=min(dp[j+x],dp[j]+y);
	}

	ll mi=1LL<<60;
	for(i=H;i<=20000;i++) mi=min(mi,dp[i]);
	cout<<mi<<endl;
}

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


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <cmath>
#include <iomanip>
#include <set>
#include <functional>

#define MOD (1000000007)

using namespace std;

typedef long long ll;
typedef pair<ll, ll> tup;
const int MAX = 510000;

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


ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<ll,ll> prime;//素因数分解でそれぞれの素数がいくつ出てきたかを保存するmap

//O(√n)
//整列済み(mapはkeyで自動で整列される)
void prime_factorize(ll n){
    if(n<=1) return;
    ll l=sqrt(n);
   for(ll i=2;i<=(ll)(l);i++) { //
        if(n%i==0){
            prime_factorize(i);prime_factorize(ll(n/i));return;
        }
    }
    //mapでは存在しないkeyの場合も自動で構築される
    prime[n]++;return;
}


vector<ll> A;
int main() {
    ll N;
    cin >> N;

    A.assign(N, 0);
    for(ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    vector<bool> dp(A[N-1]+1, true);
    for(ll i = 0; i < N; i++) {
        for(ll j = 2 * A[i];j <= A[N-1]; j+=A[i]) {
            dp[j] = false;
        }
    }

    ll ret = 0;
    for(ll i = 0; i < N; i++) {
        if(i >= 1 && A[i-1] == A[i]) continue;
        if(i <= N-2 && A[i] == A[i+1]) continue;
        if(dp[A[i]] == true) {
            ret++;
            dp[A[i]] = false;
        }
    }

    cout << ret << endl;
    return 0;    
}



Measured memory_bytes: 4856
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
using namespace std;

vector<string> tokenize(string s) {
    vector<string> ret;
    int beg = 0;
    for(int i=1; i<s.length(); ++i) {
        if(s[i] == '_') {
            ret.push_back(s.substr(beg,i-beg));
            beg = i+1;
        }
        if(s[i] <= 'Z' && s[i] >= 'A') {
            ret.push_back(s.substr(beg,i-beg));
            beg = i;
        }
    }
    if(beg < s.length()) ret.push_back(s.substr(beg));
    return ret;
}

string toL(vector<string> sv) {
    string ret;
    sv[0][0] = tolower(sv[0][0]);
    ret += sv[0];
    for(int i=1; i<sv.size(); ++i) {
        sv[i][0] = toupper(sv[i][0]);
        ret += sv[i];
    }
    return ret;
}

string toU(vector<string> sv) {
    string ret;
    for(int i=0; i<sv.size(); ++i) {
        sv[i][0] = toupper(sv[i][0]);
        ret += sv[i];
    }
    return ret;
}

string toD(vector<string> sv) {
    string ret;
    sv[0][0] =  tolower(sv[0][0]);
    ret += sv[0];
    for(int i=1; i<sv.size(); ++i) {
        ret += "_";
        sv[i][0] = tolower(sv[i][0]);
        ret += sv[i];
    }
    return ret;
}

int main() {
    string input,op;
    while(cin>>input>>op) {
        if(op == "X") break;
        vector<string> tokens;
        tokens = tokenize(input);
        if(op == "U") cout<<toU(tokens)<<endl;
        else if(op == "L") cout<<toL(tokens)<<endl;
        else if(op == "D") cout<<toD(tokens)<<endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main()
{
    int n,k,m;
    char z;
    cin>>n>>z>>k;
    if(z=='+')
    {
        m=n+k;
    }
    else
        {(z=='-');
         m=n-k;}
    cout<<m;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

long long int compress_vector(std::vector<long long int> &vec, long long int N, long long int start);


int main(){
  
  long long int N, K, tmp;
  scanf("%lld%lld", &N, &K);
  std::vector<long long int> A;
  std::vector<std::pair<long long int, long long int> > sum;
  A.push_back(0);
  sum.push_back(std::make_pair(0, 0));
  
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    A.push_back(tmp);
    sum.push_back(std::make_pair((sum[i].first+tmp-1+K)%K, i+1));
  }
  std::sort(sum.begin(), sum.end());
  
  long long int l1=0, l2, r, mid;
  long long int ans = 0;
  for(long long int i = 1; i <= N; i++){
    // update l1
    if(sum[i-1].first != sum[i].first){
      l1 = i;
      continue;
    }
    // no pair
    if(sum[i].second - sum[i-1].second >= K){
      continue;
    }
    // all pairs are possible
    if(sum[i].second - sum[l1].second < K){
      ans += i - l1;
      continue;
    }
    // bisection
    l2 = l1;
    r = i-1;
    while(r-l2 > 1){
      mid = (l2+r)/2;
      if(sum[i].second - sum[mid].second >= K)l2 = mid;
      else r = mid;
    }
    ans += i - r;
  }
  
  std::cout << ans << std::endl;
  
  return 0;
}

long long int compress_vector(std::vector<long long int> &vec, long long int N, long long int start){
  
  // make pair of index and entry of given vector
  std::vector< std::pair<long long int, long long int> > vec_pair;
  for(long long int i = 0; i < N; i++){
    vec_pair.push_back(std::make_pair(vec[i], i));
  }
  // sort vector
  std::sort(vec_pair.begin(), vec_pair.end());
  
  // compress
  long long int tmp1 = vec_pair[0].first, tmp2 = start;
  vec_pair[0].first = tmp2;
  for(long long int i = 1; i < N; i++){
    if(vec_pair[i].first != tmp1){
      tmp2++;
      tmp1 = vec_pair[i].first;
    }
    vec_pair[i].first = tmp2;
  }
  
  // re-sort in terms of index
  for(long long int i = 0; i < N; i++){
    tmp1 = vec_pair[i].first;
    vec_pair[i].first = vec_pair[i].second;
    vec_pair[i].second = tmp1;
  }
  std::sort(vec_pair.begin(), vec_pair.end());
  
  // write answer to vec
  for(long long int i = 0; i < N; i++){
    vec[i] = vec_pair[i].second;
  }

  return tmp2;
}


Measured memory_bytes: 7524
#include <stdio.h>
#include <stdlib.h>


#define	ll_int	long long int


typedef struct data_t{
	ll_int data;
	struct data_t *next;
}DATA_T;

DATA_T *BOX;
DATA_T **LAST_IN;


// 配列の初期化
void Init(int n)
{
	int i;

	for(i = 0; i < n; i++)
		LAST_IN[i] = &BOX[i];
}


// 指定した添え字の箱の末尾へデータを追加
void Push_back(int t, ll_int x)
{
	DATA_T *p;

	if( (p = (DATA_T *)malloc(sizeof(DATA_T))) == NULL){
		printf("malloc error\n");
		exit(1);
	}

	p->data = x;
	p->next = NULL;
	LAST_IN[t]->next = p;
	LAST_IN[t] = p;
}


// 内容の表示
void Dump(int t)
{
	DATA_T *p;

	if(LAST_IN[t] == &BOX[t]){
		printf("\n");
		return;
	}

	for(p = BOX[t].next; p != NULL; p = p->next){
		printf("%lld", p->data);
		if(p->next != NULL)
			printf(" ");
	}
	printf("\n");
}


// 指定した配列の内容をクリア
void Clear(int t)
{
	LAST_IN[t] = &BOX[t];
}


int main()
{
	int n, q;
	int query, t;
	ll_int x;
	int i;

	scanf("%d %d", &n, &q);

	BOX = (DATA_T *)malloc(sizeof(DATA_T) * n);
	LAST_IN = (DATA_T **)malloc(sizeof(DATA_T *) * n);

	Init(n);

	for(i = 0; i < q; i++){
		scanf("%d", &query);

		if(query == 0){
			scanf("%d %lld", &t, &x);
			Push_back(t, x);
		}else if(query == 1){
			scanf("%d", &t);
			Dump(t);
		}else if(query == 2){
			scanf("%d", &t);
			Clear(t);
		}
	}

	return 0;
}


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

int main (){
        char a,t;
        cin >>a>>t;
        if(a=='H') {
                if(t=='H') {
                        cout << 'H'<<endl;
                }else{cout << 'D'<<endl;}
        }else{
                if(t=='H') {
                        cout << 'D'<<endl;
                }else{
                        cout << 'H'<<endl;
                }
        }
        return 0;
}


Measured memory_bytes: 256
s = input()

s1 = int(s[0:2])
s2 = int(s[2:])

yymm, mmyy = True, True
if s1 > 12 or s1 == 0:
    mmyy = False

if s2 > 12 or s2 == 0:
    yymm = False

print("AMBIGUOUS" if yymm == True and mmyy == True else "YYMM" if yymm == True
        else "MMYY" if mmyy == True else "NA")

Measured memory_bytes: 3060
#include<cmath>    
#include<queue>    
#include<vector>    
#include<cstdio>    
#include<ctime>   
#include<cstring>    
#include<iostream>    
#include<algorithm>    
#define INF 0x3f3f3f3f
#define MAXN 100000
using namespace std;
int read()
{
    int f=1,x=0;char s=getchar();   
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}  
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    return x*f;
}
int main() 
{
	int x=read(),a=read(),b=read();
	printf("%d\n",(x-a)%b);
    return 0; 
} 


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7; 
const int MINF = -1050000000;


int main() {
	int n;
	string s;
	cin >> n >> s;
	int size = s.size();
	for (int i = 0; i < size; ++i) {
		if (s[i] + n > 'Z') {
			s[i] = '@' + ((s[i] + n) - 'Z');
		}
		else {
			s[i] += n;
		}
	}
	cout << s << endl;

	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
string w,q;
int as=1<<30;
int main()
{
    cin>>w;
    q=w;
    for(int i=1;i<q.length();i++)
        if(q[i]!=q[i-1])
            as=min(as,max(i,int(q.length())-i));
    cout<<min(as,int(q.length()))<<endl;
    return 0;
}

Measured memory_bytes: 512
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

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

void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

int run(istream& in, ostream& out) {
    ll A, B, K;
    in >> A >> B >> K;
    ll ans1 = max(A-K, 0LL);
    ll ans2 = max(B-max((K-A), 0LL), 0LL);

    // solution here

    out << ans1 << " " << ans2 << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
#include<stdio.h>

int main (void){
    int d;
    scanf("%d",&d);
    if(d==25)
        printf("Christmas");
    else if(d==24)
        printf("Christmas Eve");
    else if(d==23)
        printf("Christmas Eve Eve");
    else
        printf("Christmas Eve Eve Eve");
    
return 0;

}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int T = scan.nextInt();
		int[] A = new int[N+1];
		A[0] = -1;
		for(int i=1;i<N+1;i++){
			A[i] = scan.nextInt();
		}
		/*
		int count = 0;
		int min, max, gain;
		min = max = A[1];
		gain = -1;
		int[] memo = new int[N];
		int memo_i = 0;
		Arrays.fill(memo, 0);
		for(int i=2;i<N+1;i++){
			min = Math.min(min, A[i]);
			if(min==A[i]){
				max = A[i];
			}
			max = Math.max(max, A[i]);
			if(i==N){

				if(gain < max-min){
				//	System.out.println(min+","+max);
					gain = max-min;
					count = 1;
					break;
				}
				if(gain==max-min){
				//	System.out.println(min+","+max);
					count++;
					break;
				}
				break;
			}
			if(max>A[i+1]){
				memo[memo_i] = max-min;
				memo_i++;
				if(gain < max-min){
				//	System.out.println(min+","+max);
					gain = max-min;
					count = 1;
					max = A[i+1];
					min = A[i+1];
					i++;
					continue;
				}
				if(gain==max-min){
				//	System.out.println(min+","+max);
					count++;
				}
				max = A[i+1];
				min = A[i+1];
				i++;
			}
		}
		Arrays.sort(memo);
		System.out.println(count);
		*/

		int count = 0;
		int min = Integer.MAX_VALUE;
		int max = 0;
		for(int i=1;i<N+1;i++){
			if(A[i]<min){
				min = A[i];
			}else{
				int diff = A[i] - min;
				if(max==diff){
					count++;
				}else if (max<diff){
					max = diff;
					count = 1;
				}
			}
		}
		System.out.println(count);

	}
}


Measured memory_bytes: 45860
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = int.Parse(Console.ReadLine());
			while(n--!=0)
			{
				var s = Console.ReadLine();
				s = s.Replace("Hoshino", "Hoshina");
				Console.WriteLine(s);
			}
		}
	}
}

Measured memory_bytes: 5268
N = int(input())
S = input()
x = 0
X = [0]
for i in range(N):
  if S[i] == "I":
    x = x+1
    X.append(x)
  if S[i] == "D":
    x = x-1
    X.append(x)
X.sort(reverse = True)
print(X[0])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, x; cin>>n>>x;

    if (x == 1 || x == 2 * n - 1) {
        cout<<"No"<<endl;
        return 0;
    }

    cout<<"Yes"<<endl;

    if (n == 2) {
        rep(i, 3) cout<<i + 1<<endl;
        return 0;
    }

    vl ans(2 * n - 1);
    rep(i, 2 * n - 1) ans[i] = i + 1;
    if (x == 2) {
        swap(ans[2 * n - 2], ans[n - 2]);
        swap(ans[x - 2], ans[n - 1]);
        swap(ans[x - 1], ans[n]);
        swap(ans[2 * n - 3], ans[n + 1]);
    }
    else {
        swap(ans[0], ans[n - 2]);
        swap(ans[x - 1], ans[n - 1]);
        swap(ans[x], ans[n]);
        swap(ans[1], ans[n + 1]);
    }
    rep(i, 2 * n - 1) {
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 3072
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:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        n: usize,
        k: usize,
        h: [usize;n],
    }

    let mut cnt = 0;
    for i in h{
        if i>=k{
            cnt += 1;
        }
    }
    println!("{}", cnt);
}

Measured memory_bytes: 4352