akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,f[N][3];
string s;

int main() {
	cin>>s;n=s.length();
	for(int i=0;i<n;i++) {
		if(i<2) f[i][i+1]=1;
		for(int j=1;j<=2;j++) {
			if(i-j>=0)
				for(int k=1;k<=2;k++)
					if(i-j+1>=k&&s.substr(i-j-k+1,k)!=s.substr(i-j+1,j)) f[i][j]=max(f[i][j],f[i-j][k]+1);
		}
	}
	cout<<max(f[n-1][1],f[n-1][2]);
	return 0;
}


Measured memory_bytes: 2948
#include<bits/stdc++.h>
#define P pair < int , int >
using namespace std;

inline int read(){
	int a = 0;
	char c = getchar();
	bool f = 0;
	while(!isdigit(c)){
		if(c == '-')
			f = 1;
		c = getchar();
	}
	while(isdigit(c)){
		a = (a << 3) + (a << 1) + (c ^ '0');
		c = getchar();
	}
	return f ? -a : a;
}

const int dir[4][2] = {0,1,0,-1,1,0,-1,0};
bool vis[520][520];
char tial[520][520];
int H , W;
queue < P > q;

inline char getc(){
	char c = getchar();
	while(c != '.' && c != '#')
		c = getchar();
	return c;
}

void bfs(int x , int y){
	q.push(P(x , y));
	vis[x][y] = 1;
	while(!q.empty()){
		P now = q.front();
		q.pop();
		for(int i = 0 ; i < 4 ; ++i)
			if(tial[now.first + dir[i][0]][now.second + dir[i][1]] == '#' && !vis[now.first + dir[i][0]][now.second + dir[i][1]]){
				vis[now.first + dir[i][0]][now.second + dir[i][1]] = 1;
				q.push(P(now.first + dir[i][0] , now.second + dir[i][1]));
			}
	}
}

int main(){
	H = read();
	W = read();
	for(int i = 1 ; i <= H ; ++i)
		for(int j = 1 ; j <= W ; ++j)
			tial[i][j] = getc();
	for(int i = 1 ; i <= W ; ++i)
		vis[H][i] = 1;
	for(int i = 2 ; i < W ; ++i)
		for(int j = H - 1 ; j > 1 ; --j)
			if(!vis[j][i] && tial[j][i] == '#'){
				bfs(j , i);
				int x = j , y = i;
				while(!vis[x][y - 1] && !vis[x + 1][y])
					vis[++x][y] = 1;
			}
	for(int i = 1 ; i <= H ; ++i){
		for(int j = 1 ; j <= W ; ++j)
			putchar(vis[i][j] ? '#' : '.');
		putchar('\n');
	}
	putchar('\n');
	for(int i = 1 ; i <= H ; ++i){
		for(int j = 1 ; j <= W ; ++j)
			putchar(vis[i][j] && tial[i][j] == '.' ? '.' : '#');
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>

int main(){
	long long N,M,i;
	scanf("%lld%lld",&N,&M);
	long long P[M],Y[M],C[M],A[M];
	long long count[N+1];
	for(i=0;i<M;i++){
		scanf("%lld%lld",&P[i],&Y[i]);
		C[i]=i;
	}
	for(i=0;i<=N;i++)count[i]=0;
	
	//sort
	long long h=M;
	long long swapped=0;
	while(h>1 || swapped==1){
		if(h>1)h=h*10/13;
		swapped=0;
		for(i=0;i<M-h;i++){
			if(Y[i]>Y[i+h]){
				long long tmp=Y[i];
				Y[i]=Y[i+h];
				Y[i+h]=tmp;
				tmp=P[i];
				P[i]=P[i+h];
				P[i+h]=tmp;
				tmp=C[i];
				C[i]=C[i+h];
				C[i+h]=tmp;
				swapped=1;
			}
		}
	}
	
	for(i=0;i<M;i++){
		count[P[i]]++;
		A[C[i]]=P[i]*1000000+count[P[i]];
	}
	for(i=0;i<M;i++){
		if(A[i])
		printf("%012lld\n",A[i]);
	}	
	return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define int long long
using namespace std;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MAXIN(x) max_element(ALL(x)) - v.begin();
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PI 3.14159265358979323846
using namespace std;


signed main() {
    string s, t;
    cin >> s >> t;

    // string a = t.substr(s.size(),1);
    // if(a.size() == 1) cout << "Yes" <<endl ;
    // else cout << "No" <<endl ;

    string a = t.substr(0, s.size());
    if( a == s){
        cout << "Yes" <<endl ;
    }else{
        cout << "No" <<endl ;
    }


    return 0;
}

Measured memory_bytes: 3628
import sys

L,R = map(int,input().split())
if R-L>673:
    print(0)
else:
    ans =2019
    for i in range(R-L+1):
        for j in range(R-(L+i)):
            m = L+i
            n = L+j+i+1
            ans = min(ans, m*n%2019)
            if ans == 0:
                print(ans)
                sys.exit()
    print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=1e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false); 

    int n;
    cin >> n;
    vector<ll> a(n),b(n+1);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    rep(i,n) b[i+1]+=b[i]+a[i];
    int ans=0;
    repr(i,1,n) {
        if (a[i]>2*b[i]) ans=i;
    }
    cout << n-ans << endl;
    
    return 0;
}


Measured memory_bytes: 4804
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

typedef long long ll;
ll n, s, c, mn = 1e18, a;
int main()
{
	cin >> n;
	while (n--) {
		scanf("%lld", &a);
		if (a < 0) c++, a *= -1;
		mn = min(mn, a);
		s += a;
	}
	cout << s - 2 * mn * (c % 2);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//#define _debug
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back
//#define _online_judge

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, //data type
 null_type, //
 less<int>, //
 rb_tree_tag, //red-black tree
 tree_order_statistics_node_update> new_data_set;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = static_cast<const int>(1e4 + 5);
const int MOD = 1000000007;




int main(){
    FASTIO;
#ifdef _online_judge
    freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
#endif

    int arr[5];
    FOR(i,0,5) cin >> arr[i];
    sort(arr,arr+5);
    int limit;cin >> limit;
    if(arr[4]-arr[0] <= limit){
        cout << "Yay!";
        return 0;
    }
    cout << ":(";
    return 0;
}


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

int main()
{
	string W;
	string T; 
	int count = 0;
	
	cin >> W;

	for (int i = 0; i < W.size(); i++) {
		if ('A' <= W[i] && 'Z' >= W[i])W[i] += 'a' - 'A';
	}

	cin >> T;
	while (T != "END_OF_TEXT"){
		
		for (int i = 0; i < T.size(); i++) {
			if ('A' <= T[i] && 'Z' >= T[i])T[i] += 'a' - 'A';
		}
		if (W == T)count++;
		cin >> T;
	}

	cout << count << endl;

	
	return 0;

}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <string>
using namespace std;
int main(){
    string S,T;
    cin >> S >> T;
    bool judge = false;
    for(int i = 0; i < S.size();i ++){
        S += S.at(0);
        reverse(S.begin(),S.end());
        S.erase(S.end() - 1);
        reverse(S.begin(),S.end());
        if(S == T) judge = true;        
    }
    if(judge == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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



int main() {
    int x, n;
    cin >> x >> n;
    
    vector<int> p(n);
    rep(i,n) {
        cin >> p[i];
    }
    
    bool tf;
    rep(i,100) {
        tf = true;
        rep(j,n) {
            if(x - i == p[j]) {
                tf = false;
                break;
            }
        }
        
        if(tf) {
            cout << x - i << endl;
            break;
        }
        
        tf = true;
        rep(j,n) {
            if(x + i == p[j]) {
                tf = false;
                break;
            }
        }
        
        if(tf) {
            cout << x + i << endl;
            break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin >> a;
  if ((a[0] == a[1] && a[1] == a[2]) || (a[1] == a[2] && a[2] == a[3])) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n))#親ノード
        self.size = [1]*n #グループの要素数
 
    def root(self, x): #root(x): xの根ノードを返す．
        while self.parent[x] != x:
            self.parent[x] = self.parent[self.parent[x]]
            x = self.parent[x]
        return x 
 
    def merge(self, x, y): #merge(x,y): xのいるグループと$y$のいるグループをまとめる
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.size[x] < self.size[y]: 
            self.size[y] += self.size[x] #yの要素数を更新
            self.parent[x] = y #xをyにつなぐ
        else:
            self.size[x] += self.size[y] #xの要素数を更新
            self.parent[y] = x #yをxにつなぐ
        return True
 
    def issame(self, x, y): #same(x,y): xとyが同じグループにあるならTrue
        return self.root(x) == self.root(y)
        
    def size(self,x): #size(x): xのいるグループの要素数を返す
        return self.size[self.root(x)]

n = int(input())
xy = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行

ans = n
s = {(x1-x2, y1-y2) for (x1,y1) in xy for (x2,y2) in xy}
s.remove((0,0))

for dx,dy in s:
    uf = UnionFind(n)
    c = 0
    for i, (xi,yi) in enumerate(xy):
        for j, (xj,yj) in enumerate(xy):
#        for j in range(i+1,n):
#            xj, yj = xy[j]
            if xj-xi == dx and yj-yi == dy:
                uf.merge(i,j)
                c+=1
#    print(uf.parent)
    if ans > n-c:
        ans = n-c
                

print(ans)    









        










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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18*5;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  vpll p(n);
  vll x(n), y(n);
  rep(i,n){
    ll a,b; cin>>a>>b;
    p[i]={a,b};
    x[i]=a, y[i]=b;
  }
  vsort(x);
  vsort(y);
  
  ll ans=LINF;
  rep(x1,n){
    irep(x2,x1+1,n){
      rep(y1,n){
        irep(y2,y1+1,n){
          ll cnt=0;
          rep(i,n){
            ll px=p[i].first, py=p[i].second;
            if(x[x1]<=px&&px<=x[x2] && y[y1]<=py&&py<=y[y2]){
              cnt++;
            }
          }
          if(cnt>=k){
            chmin(ans,(x[x2]-x[x1])*(y[y2]-y[y1]));
          }
        }
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  int n;
  cin>>n;
  ll a[n];
  map<ll,ll> m;
  for(i=0;i<n;i++){
    cin>>a[i];
    m[a[i]]++;
  }
  int stage=0;
  for(auto it=m.rbegin();it!=m.rend();++it){
    if(stage==0){
      if(it->second>=4) {
        cout<<it->first*it->first<<endl;
        return 0;
      }
      else if(it->second>=2){
        stage=it->first;
      }
    }
    else if(stage>0){
      if(it->second>=2){
        cout<<it->first*stage<<endl;
        return 0;
      }
    }
  }
  cout<<0<<endl;
  return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

int main() {
  int n;
  ll k;
  cin >> n >> k;
  vi a(n);
  REP(i, n) cin >> a[i];
  REP(i, n) a[i]--;
  vi tm;
  vc(bool) ok(n, false);
  int cnt = 0;
  auto add = [&](int x) {
    tm.emplace_back(x);
    if(ok[x]) {
      return false;
    }
    
    ok[x] = true;
    return true;
  };
  int ans = 0;
  add(0);
  for (ll i = 0; i < k; i++) {
    int now = tm.back();
    int nxt = a[now];
    auto dd = add(nxt);
    ll ban = 0;
    if(!dd) {
      REP(j, tm.size()) {
        if (tm[j]==nxt) {
          ban = j;
          break;
        }
      }
      ll mod = i-(ban)+1;
      k -= ban;
      k %= mod;
      int it = ban + k;
      ans = tm[it];
      cout << ans+1 << endl;
      return 0;
    }
  }
  cout << tm.back()+1 << endl;

  return 0;
}

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

int main() {
	string s;
	cin >> s;

	if (s == "A") {
		cout << "T" << endl;
	}
	else if (s == "T") {
		cout << "A" << endl;
	}
	else if (s == "C") {
		cout << "G" << endl;
	}
	else{
		cout << "C" << endl;
	}
}
/*int main() {
	int x, y;
	
	cin >> x >> y;

	if (x >= 60) {
		if (y >= 0) {
			cout << "合格" << endl;
		}
		else if (y <= 0) {
			cout << "履修登録忘れ" << endl;
		}
	}
	else {
		cout << "残念　不合格" << endl;
	}
}*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int f[1<<21];
int a[22][22];
int lowbit(int x)
{
    return x&-x;
}
int count1(int n)
{
    int ret=0;
    while(n)
    {
        ret++;
        n-=lowbit(n);
    }
    return ret;
}
int main()
{
    int i,j,k,l,n;
    scanf("%d",&n);
    f[0]=1;
    for(i=1;i<=n;i++)
        for(j=1;j<=n;j++)
            scanf("%d",&a[i][j]);
    for(j=1;j<(1<<n);j++)
    {
        for(l=0;l<n;l++)
        {
            if((j&(1<<l))==0||!a[count1(j)][n-l])
                continue;
            f[j]=(f[j]+f[j^(1<<l)])%1000000007;
        }
    }
    printf("%d",f[(1<<n)-1]);
    return 0;
}

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

count=0
for i in range(N):
  A = list(map(int, input().split()))
  sum=0
  for j in range(M):
    sum+=B[j]*A[j]
  if sum+C>0:
    count+=1

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

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

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  ll h;cin>>h;

  int count = 1;
  while(h>1){
    h /= 2;
    count++;
  }

  ll l = 1;
  REP(i,count){
    l *= 2;
  }
  cout<<l-1<<endl;

 

  return 0;
}

Measured memory_bytes: 256
i=0
m=0
for i in range(4):
    a,b=map(int,input().split())
    if a==1:
        print(6000*b)
    elif a==2:
        print(4000*b)
    elif a==3:
        print(3000*b)
    else:
        print(2000*b)
    i+=1


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

using namespace std;

const int Mod = 1e9 + 7, Nmax = 2005;
typedef long long ll;

namespace
{
    void inm_to(int &x, int y) { x = (ll) x * y % Mod; }
    int inm(int x, int y) { return (ll) x * y % Mod; }
    int inm(int x, int y, int z) { return (ll) x * y % Mod * z % Mod; }
    void add_to(int &x, int y) { x+=y; if(x>=Mod) x-=Mod; }
    int add(int x, int y) { x+=y; return x<Mod ? x : x-Mod; }

    int power(int a, int b)
    {
        int ans = 1;
        while(b)
        {
            if(b&1) inm_to(ans, a);
            inm_to(a, a); b >>= 1;
        }
        return ans;
    }
}

int N, K;
int fact[2*Nmax*Nmax], ifact[2*Nmax*Nmax], dp[Nmax][Nmax];

int comb(int n, int k)
{
    return inm(fact[n], ifact[k], ifact[n-k]);
}

int aranj(int n, int m)
{
    /// comb(n+m, n)
    return comb(n+m, n);
}

void prec(int lim)
{
    int i;
    fact[0] = ifact[0] = 1;

    for(i=1; i<=lim; ++i) fact[i] = inm(fact[i-1], i);
    ifact[lim] = power(fact[lim], Mod-2);
    for(i=lim-1; i; --i) ifact[i] = inm(ifact[i+1], i+1);
}

int main()
{
   // freopen("input", "r", stdin);
   // freopen("output", "w", stdout);
    cin.sync_with_stdio(false);

    int i, j;
    cin >> N >> K;

    if(K == 1)
    {
        cout << 1 << '\n';
        return 0;
    }

    prec(2 * N * K);

    dp[0][0] = 1;

    for(i=0; i<=N; ++i)
        for(j=0; i+j<=N; ++j)
            if(i + j)
            {
                if(j) dp[i][j] = inm(dp[i][j-1], i+j, aranj(K-2, i * K + (j-1) * (K-1)));
                if(i) add_to(dp[i][j], dp[i-1][j+1]);
            }

    cout << dp[N][0] << '\n';

    return 0;
}


Measured memory_bytes: 78592
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = 1000000007;
using namespace std;
using vec = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}
const int dy[4] = {-1, 0, 0, 1};
const int dx[4] = {0, -1, 1, 0};

int r, D, x;

int main(int argc, char *argv[]){
    cin >> r >> D >> x;
    int res;
    rep(i, 10){
        res = r * x - D;
        x = res;
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

class Program
{
    const int MOD = 1000000007;
    static void Main(string[] args)
    {
        new Program().Solve();
    }

    void Solve()
    {
        Scanner cin = new Scanner();
        int x = cin.NextInt();
        int a = cin.NextInt();

        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        if (x < a)
        {
            Console.WriteLine(0);
        }
        else
        {
            Console.WriteLine(10);
        }

        Console.Out.Flush();
        
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string Next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public char[] ArrayChar()
    {
        return Next().ToCharArray();
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextInt() + add;
        }
        return Array;
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextLong() + add;
        }
        return Array;
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 11092
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;

fn getword() -> String {
    let mut stdin = std::io::stdin(); let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.is_err() ||u8b[0] <= ' ' as u8 {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = std::string::String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}
fn parse<T : std::str::FromStr>(s : &str) -> T {
     return s.parse::<T>().ok().unwrap();
}
fn get<T: std::str::FromStr>() -> T {
    parse(&getword())
}


fn check(mut n:i64, d:&mut Vec<i64>) -> bool {
  while n > 0 {
    let a:i64 = n%10;

    if d.into_iter().find(|x| **x == a).is_some() { return false; }
    
    n = n/10;  
  }
  return true;
}

fn main() {
  let mut n:i64 = get();   
  let k:i64 = get();   

  let mut d = Vec::new();
  for i in 0..k {
    let di:i64 = get();  
    d.push(di);
  }

  
  loop {
    if check(n, &mut d) {break;} 
    
    n = n+1;
  }
 
  println!("{}", n);
}


Measured memory_bytes: 4352
N = input()
ans = 0
n = len(N)
a = N.count("a")
ans += a * (a-1) // 2
a = N.count("b")
ans += a * (a-1) // 2
a = N.count("c")
ans += a * (a-1) // 2
a = N.count("d")
ans += a * (a-1) // 2
a = N.count("e")
ans += a * (a-1) // 2
a = N.count("f")
ans += a * (a-1) // 2
a = N.count("g")
ans += a * (a-1) // 2
a = N.count("h")
ans += a * (a-1) // 2
a = N.count("i")
ans += a * (a-1) // 2
a = N.count("j")
ans += a * (a-1) // 2
a = N.count("k")
ans += a * (a-1) // 2
a = N.count("l")
ans += a * (a-1) // 2
a = N.count("m")
ans += a * (a-1) // 2
a = N.count("n")
ans += a * (a-1) // 2
a = N.count("o")
ans += a * (a-1) // 2
a = N.count("p")
ans += a * (a-1) // 2
a = N.count("q")
ans += a * (a-1) // 2
a = N.count("r")
ans += a * (a-1) // 2
a = N.count("s")
ans += a * (a-1) // 2
a = N.count("t")
ans += a * (a-1) // 2
a = N.count("u")
ans += a * (a-1) // 2
a = N.count("v")
ans += a * (a-1) // 2
a = N.count("w")
ans += a * (a-1) // 2
a = N.count("x")
ans += a * (a-1) // 2
a = N.count("y")
ans += a * (a-1) // 2
a = N.count("z")
ans += a * (a-1) // 2
ans = n * (n-1) // 2 - ans + 1
print(ans)

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

vector<vector<int>>edge(1e5+2);
vector<bool>flag(1e5+2,false);

bool dfs(int index){
    if(flag[index]==true) return false;
    flag[index] = true;
    for(int i=0;i<edge[index].size();i++){
        dfs(edge[index][i]);
    }
    return true;
}

signed main(void){
    int n,m; cin >> n >> m;
    for(int i=0;i<m;i++){
        int x,y,z; cin >>x >>y >> z;
        x--;y--;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        if (dfs(i)==true) ans++;
    }
    cout <<ans << endl;
    return 0;
}

Measured memory_bytes: 8832
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
#define END {cout << "First\n"; return 0;}

int main() {
    int N, a, b, i;
    int conLeave[100000] = {};
    vector<set<int> > g(100000);
    cin >> N;
    set<int>::iterator it;

    for (i = 0; i < N-1; i++) {
        cin >> a >> b;
        a--, b--;
        g[a].insert(b);
        g[b].insert(a);
    }

    // get a list of leaves and where they connect to
    vector<int> leaves;
    for (i = 0; i < N; i++) {
        if (g[i].size() == 1) {
            if (conLeave[*g[i].begin()]) END; 
            conLeave[*g[i].begin()]++;
            leaves.push_back(i);
            //printf("push %d\n", i+1);
        }
    }


    // Continually choose leaves
    for (i = 0; i < leaves.size(); i++) {
        int leaf = leaves[i];
        if (g[leaf].size() <= 0) END;
        int conn = *g[leaf].begin();
        //printf("leaf: %d, explore: %d\n", leaf+1, conn+1);

        // everything that was connected has one less edge
        for (it = g[conn].begin(); it != g[conn].end(); ++it) {
            //printf("check %d\n", *it+1);
            g[*it].erase(conn);
            if (g[*it].size() == 1) {
                int newConn = *g[*it].begin();
                if (conLeave[newConn]) END;
                conLeave[newConn]++;
                leaves.push_back(*it);
                //printf("push %d\n", *it+1);
            }
        }
    }

    cout << "Second\n";
}

Measured memory_bytes: 15104
#include <iostream>
#include <vector>

using namespace std;

int selection_sort(vector<int>& a) {
    int c = 0;
    for (int i = 0; i < a.size(); i++) {
        int minJ = i;
        for (int j = i + 1; j < a.size(); j++) {
            if (a[j] < a[minJ]) {
                minJ = j;
            }
        }
        if (minJ != i) {
            swap(a[i], a[minJ]);
            c++;
        }
    }
    return c;
}

int main() {
    int n;
    cin >> n;
    vector<int> a = vector<int>(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int count = selection_sort(a);
    for (int i = 0; i < a.size(); i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << a[i];
    }
    cout << endl << count << endl;

    return 0;
}


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

#define MAXN 100

int n, x;
int arr[MAXN+10];
int ans;

int main()
{
    scanf("%d%d", &n, &x);
    int i;
    for(i=0; i<n; i++) scanf("%d", &arr[i]);
    sort(arr, arr+n);

    for(i=0; i<n; i++)
    {
        if(arr[i]>x) break;
        x-=arr[i];
        ans++;
    }

    if(i==n && x!=0) ans--;
    printf("%d", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
int main(){
	reg ll a;reg int x,y,z;
	scanf("%lld%1d.%1d%1d",&a,&x,&y,&z);
	z+=y*10;
	printf("%lld\n",a*x+a*z/100);
	return 0;
}

Measured memory_bytes: 3828
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

int main() {
  uint N = 0, T = 0;
  int A = 0;
  std::cin >> N >> T >> A;

  double dt_min = std::abs(T - 600.0) + 1;
  uint i_nearest = 0;
  for (size_t i = 1; i < N + 1; i++) {
    uint H_i = 0;
    std::cin >> H_i;

    double T_i = T - H_i * 0.006;
    double dt = std::abs(A - T_i);
    if (dt < dt_min) {
      dt_min = dt;
      i_nearest = i;
    }
  }

  std::cout << i_nearest << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string S;
	ll count;
	cin >> S;
	FOR(i,0,S.size()){
		if(i%2&&(S.at(i)=='L'||S.at(i)=='U'||S.at(i)=='D'))
			count++;
		else if(i%2==0&&(S.at(i)=='R'||S.at(i)=='U'||S.at(i)=='D'))
			count++;
	}

	if(count==S.size())
		Yes();
	else
		No();
		
		return 0;
}



Measured memory_bytes: 3664
import heapq
x,y,a,b,c=map(int, input().split())
p=[int(i) for i in input().split()]
q=[int(i) for i in input().split()]
r=[int(i) for i in input().split()]

p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
ri,pi=0,0
ans=[]
for i in range(x):
    ans.append(p[i])
for i in range(y):
    ans.append(q[i])
ans.sort()
for i in range(len(r)):
    if ans[pi]<r[i]:
        ans[pi]=r[i]
        pi+=1
    else:
        break
print(sum(ans))


Measured memory_bytes: 23232
#include <iostream>

using namespace std;

int main(void)
{
    string code;

    cin >> code;

    for(int i = 1; i < code.length(); i++){
        if(code[i] == code[i - 1]){
            cout << "Bad" << endl;
            return 0;
        }
    }


    cout << "Good" << endl;
    return 0;
}


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

int main(){
  int a,b;
  double c;
  cin >> a >> b;
  c = (a + b)/2.0;
  if((int)(10*c)%10==0){
    cout << c << endl;
  }else{
    cout << (int)c + 1 << endl;
  }
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int k, x; cin >> k >> x;
  for (int i = x - k + 1; i <= x + k - 1; ++i) {
    cout << i << " \n"[i == x + k - 1];
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    string s, t; cin>>s>>t;
    t.pop_back();

    cout << (s == t ? "Yes" : "No") << endl;
    return 0;
}

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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> a(H);
    vector<string> b(H + 2);
    for(int i = 0; i < H; i++){
        cin >> a.at(i);
    }
    for(int i = 0; i < H + 2; i++){
        for(int j = 0; j < W + 2; j++){
            (b.at(i)).push_back('#');
        }
    }
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            (b.at(i + 1)).at(j + 1) = (a.at(i)).at(j);
        }
    }
    for(int i = 0; i < H + 2; i++){
        cout << b.at(i) << endl;
    }
    /*for(int i = 0; i < H + 2; i++){
        if(i == 0 || i == H + 1){
            for(int j = 0; j < W + 2; j++){
                cout << "#";
            }
        }else{
            for(int j = 0; j < W + 2; j++){
                if(j == 0 || j == W + 1){
                    cout << "#";
                }else{
                    cout << (a.at(i - 1)).at(j - 1);
                }
            }
        }
        cout << endl;
    }*/
}

/*
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 0) >= this->size() (which is 0)
*/

Measured memory_bytes: 3600
#include <bits/stdc++.h>
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
#define endl '\n'
#define PB push_back
#define MP make_pair
#define first F
#define second S
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1   e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
int32 gcd(int32 a,int32 b){return b?gcd(b,a%b):a;}
int32 lcm(int32 a,int32 b){return a/gcd(a,b)*b;}



void solve_test(){

    int a ;
    cin>>a;

    if(a == 0)
        cout<<"1" ;
    else
        cout<<"0" ;

}

int main(){
    cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    int32 test = 1 ;
    //cin>>test ;
    while(test--){

         solve_test() ;


    }

    return 0 ;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    string s;
    cin >> s;
    ll N = s.size();

    ll cntA = 0;
    ll res = 0;
    REP(i, N){
    	if(s[i] == 'A') cntA++;
    	else if(s[i] == 'B'){
    		if(i == N-1) continue;
    		if(s[i+1] == 'C'){
    			res += cntA;
    				i++;
    		}else{
    			cntA = 0;
    		}
    	}
    	else if(s[i] == 'C') cntA = 0;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 720
#include <stdio.h>
#include <string>

using namespace std;

int main(){
  int n;
  scanf("%d", &n);
  int c,o,r1,r2,r3;
  char event[16];
  for(int i=0;i<n;i++){
    c=o=r1=r2=r3=0;
    while(o!=3){
      scanf("%s", event);
      string e(event);
      if(e == "HIT"){
        c+=r3;
        r3=r2;r2=r1;r1=1;
      }else if(e == "HOMERUN"){
        c+=r3+r2+r1+1;
        r3=r2=r1=0;
      }else{
        o++;
      }
    }
    printf("%d\n", c);
  }
  return 0;
}

Measured memory_bytes: 0
n = int(input())
s = 0
a = [input().split() for i in range(n)]

l = [0]
r = [0]
for m in range(n):
    l.append(a[m][0])
    r.append(a[m][1])

for p in range(1,n+1):
    s += int(r[p])-int(l[p])+1

print(s)

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

using namespace std;


struct Entry {
  int size;
  vector<int> idxs;
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  string S;
  cin >> S;

  vector<vector<int>> chars(256);

  for (int i = 0; i < N; ++i) {
    chars[S[i]].push_back(i);
  }

  queue<Entry> q;
  for (auto&& idxs : chars) {
    if (idxs.size() >= 2) {
      Entry e{1, move(idxs)};
      q.emplace(move(e));
    }
  }

  unordered_map<char, vector<int>> chars2;

  int result = 0;
  for (; !q.empty(); q.pop()) {
    auto&& entry = q.front();
    chars2.clear();
    int min_right = numeric_limits<int>::max();
    int max_left = 0;
    for (auto& idx : entry.idxs) {
      auto next = idx + entry.size;
      max_left = max(max_left, idx);
      min_right = min(min_right, next);
      if (next < N) {
        chars2[S[next]].push_back(idx);;
      }
    }
    if (max_left < min_right) {
      continue;
    }
    for (auto&& idxs : chars2) {
      if (idxs.second.size() >= 2) {
        Entry e{entry.size + 1, move(idxs.second)};
        q.emplace(move(e));
      }
    }
    result = max(result, entry.size);
  }

  cout << result << endl;

}


Measured memory_bytes: 512
#include <stdio.h>
int main(int argc, char const *argv[])
{
  int n;
  scanf("%d",&n);
  int a[n];
  bool one=false;
  int j=1;
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(a[i]==1) one=true;
    if(a[i]==j) j++;
  }
  if(!one){
    printf("-1");
    return 0;
  }
  printf("%d",n-j+1);
  return 0;
}


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

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

typedef pair<int,int> pi;

bool inline in(int x, int y)
{
    return (0<=x&&x<3 && 0<=y&&y<3);
}

int main()
{
    int n;
    int dx[]={1,-1,0,0}, dy[]={0,0,1,-1};
    while(cin >>n,n)
    {
        char s,t,b;
        scanf(" %c %c %c",&s,&t,&b);

        pi S((s-'A')/3,(s-'A')%3);
        pi T((t-'A')/3,(t-'A')%3);
        pi B((b-'A')/3,(b-'A')%3);

        //(j,i)??????????¢????
        double dp[3][3]={0};

        dp[S.fi][S.se]=1;
        rep(i,n)
        {
            double newdp[3][3]={0};
            //?????¨??????(x,y)
            rep(y,3)rep(x,3)
            {
                rep(j,4)
                {
                    int nx=x+dx[j], ny=y+dy[j];
                    if(in(nx,ny) && B!=pi(ny,nx))
                    {
                        //?§????
                        newdp[ny][nx]+=dp[y][x]/4;
                    }
                    else
                    {
                        //??¨?????????
                        newdp[y][x]+=dp[y][x]/4;
                    }
                }
            }

            memcpy(dp,newdp,sizeof(newdp));
        }

        printf("%.10lf\n", dp[T.fi][T.se]);
    }
    return 0;
}

Measured memory_bytes: 3044
N = int(input())
A = list(map(int, input().split()))

MAX_ABS = 0
MAX_ABS_NUMBER = 0
MAX_ABS_NUMBER_INDEX = 1

for i, a in enumerate(A, start=1):
    if abs(a) > MAX_ABS:
        MAX_ABS = abs(a)
        MAX_ABS_NUMBER = a
        MAX_ABS_NUMBER_INDEX = i


if MAX_ABS_NUMBER >= 0:
    print(2 * N - 1)
    for i in range(1, N + 1):
        print(MAX_ABS_NUMBER_INDEX, i)
    for i in range(1, N):
        print(i, i + 1)

else:
    print(2 * N - 1)
    for i in range(1, N + 1):
        print(MAX_ABS_NUMBER_INDEX, i)
    for i in range(N, 1, -1):
        print(i, i - 1)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
  std::unordered_map<ll, int> mp; 
  ll n, m;
  cin >> n >> m;
  ll ans_ac = 0;
  ll ans_wa = 0;
  rep(i,m) {
    ll p;
    string m;
    cin >> p >> m;
    if (m == "AC") {
      if (mp.count(p) == 0) {
        ans_ac++;
        mp[p] = -1;
      }
      else {
        if (mp[p] != -1) {
          ans_ac++;
          ans_wa += mp[p];
          mp[p] = -1;
        }
      }
    }
	else {
      if (mp.count(p) == 0) {
        mp[p] = 1;
        continue;
      }
      else {
        if (mp[p] != -1) mp[p]++;
      }
    }
  }
  cout << ans_ac << endl;
  cout << ans_wa << endl;
  return 0;
}


Measured memory_bytes: 4388
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end() 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

int main(){
    int A,B,C;
    cin>>A>>B>>C;
    if((A==B&&B!=C)||(A==C&&A!=B)||(B==C&&A!=B)){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  	public static void main(String[] args) {
      	Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      	System.out.println((a + b) * c / 2 );
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>

//#define DEBUG1

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

#ifdef DEBUG1
	printf("ans = %d\n", 24 - m + 24);
#endif
	printf("%d\n", 24 - m + 24);
#ifdef DEBUG1
	getch();
#endif

	return 0;
}


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

using namespace std;
using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i=0;i<s.length();i++){
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    }
    cout << s << endl;
    return 0;
}

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

int n;
int w[101];
int iw[101];
int main(){
    cin >> n;
    for(int i=0; i<n; i++) cin >> w[i];

    iw[0]=w[0];
    for(int i=1; i<n; i++) iw[i] = w[i]+iw[i-1];

    int sum = iw[n-1];
    int pre = abs((sum - iw[0]) - iw[0]);
    int res;
    for(int i=1; i<n; i++){
        int dif = abs((sum - iw[i]) - iw[i]);
        if( dif > pre ) break;
        //cerr << sum << ", "<<dif << endl;
        pre = dif;
    }

    cout << pre << endl;;
    return 0;
}

Measured memory_bytes: 256
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.math.*;

import static java.util.Comparator.*;


public class Main {
    static int findDiv(int n)
    {
        for(int i=3;i<=Math.sqrt(n);i++)
        {
            if(n%i==0)
            {
                return Math.max(i,n/i);
            }
        }
        return 1;
    }
    public static void main(String[] args) throws IOException {
        FastReader s = new FastReader();
//        int t=s.nextInt();
////        StringBuilder ans=new StringBuilder();
//        while(t-->0) {
            String str=s.next();
            int flag=0;

            for(int i=0;i<str.length();i++)
            {
                if(str.charAt(i)=='7')
                {
                    flag=1;
                    break;
                }
            }
            if(flag==0)
            {
                System.out.println("No");
            }
            else {
                System.out.println("Yes");
            }

//        }
    }

}


class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException  e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

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

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

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}
//3
//2 1 3
//3 3 6
//99995 9998900021 999890031

Measured memory_bytes: 32712
#include <iostream>
#include <stack>
#include <vector>
#include <string>
 
using namespace std;
 
int main() {
    stack<int> S1;
    vector< pair<int, int> > S2;
    char ch;
    int sum = 0;
    for (int i = 0; cin >> ch; i++) {
        if (ch == '\\') {
            S1.push(i);
        }
        else if (ch == '/' && S1.size() > 0) {
            int j = S1.top();
            S1.pop();
             
            int area = i - j;
            sum += area;
             
            while (S2.size() > 0 && (*(S2.end()-1)).first > j) {
                area += (*(S2.end()-1)).second;
                S2.pop_back();
            }
             
            S2.push_back(make_pair(j, area));
        }
    }
     
    cout << sum << endl;
    cout << S2.size();
     
    for (vector<pair<int, int> >::iterator i = S2.begin(); i != S2.end(); i++) {
        cout << " ";
        cout << (*i).second;
    }
     
    cout << endl;
    return 0;
}
 

 

Measured memory_bytes: 3188