akhauriyash/Code-Regression huggingface dataset:
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
*/
#include <bits/stdc++.h>
#define LL              long long
#define ll              long long
#define SL(n)           scanf("%lld",&n)
#define LF              double
#define SF(n)           scanf("%lf",&n)
 
#define pb              push_back
#define mp              make_pair
 
#define ON(n,i)         (n|(1LL<<i))
#define OFF(n,i)        (n&(~(1LL<<i)))
#define CHK(n,i)        (n&(1LL<<i))
 
#define ff              first
#define ss              second
 
#define SET(arr)        memset( arr , -1 , sizeof arr)
#define RESET(arr)      memset( arr,0,sizeof arr)
 
#define srt(v)          sort(v.begin(),v.end())
#define uniq(v)			v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define found( s,d )    (s.find(d) != s.end())
 
#define FOR(i,s,e)      for( LL i = s ; i<=e ; i++ )
#define RFOR(i,e,s)     for( LL i = e ; i>=s ; i-- )
         
 
#define FILEIN          freopen("in.txt","r",stdin)
#define FILEOUT         freopen("WA.txt","w",stdout)
 
#define DEBUG(x)        cerr<<#x<<" = "<<x<<endl
#define PRINTALL(v)     {cerr<<endl<<"Printing: "<<#v<<endl;for(LL i = 0 ; i<v.size(); i++) DEBUG(v[i]); cerr<<endl;}
 
using namespace std;


int main(){
   
  LL a[5];
  FOR(i,0,4) {
    
    SL(a[i]);
    if(a[i] == 0 ) cout<<i+1<<endl;
  }
    
return 0;}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    vector<int> lucas(0);
    int n; cin>>n;
    int i=0;
    while (i<=n) {
        if(i==0) lucas.push_back(2);
        else if(i==1) lucas.push_back(1);
        else lucas.push_back(lucas.at(i-1)+lucas.at(i-2));
        i++;
    }
    cout<<lucas.back()<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  	cin>>n;
  	vector<int> p(n),a(n),b(n);
  	for(int i=0;i<n;i++) p[i]=i+1;
  	for(int i=0;i<n;i++) cin>>a[i];
  	for(int i=0;i<n;i++) cin>>b[i];
   	int x,y;
  	int cnt=0;
  	do{
      if (a==p) x=cnt;
      if (b==p) y=cnt;
      cnt++;
    }while (next_permutation(p.begin(),p.end()));
  	cout<<abs(x-y)<<endl;
}

Measured memory_bytes: 764
#include <stdio.h>

int main(){
    int a, b;
    char op;

    while(1){
        scanf("%d %c %d", &a, &op, &b);
        if(op=='?'){
            break;
    	}else if(op=='+'){
    	    printf("%d\n", a+b);
    	}else if(op=='-'){
    	    printf("%d\n", a-b);
    	}else if(op=='*'){
    	    printf("%d\n", a*b);
    	}else if(op=='/'){
    	    printf("%d\n", a/b);
        }
    }
    return 0;
}

Measured memory_bytes: 1816
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<functional>

using namespace std;
typedef pair<int, pair<int, int >> TP;

int N, K;
vector<vector<int>> e;
int cost[5000];
int able[5000];

int d[5000][5001];

TP maketp(int a, int b, int c) {
	return TP(a, make_pair(b, c));
}

int djk(int s, int g) {
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= N; j++) {
			d[i][j] = 2000000000;
		}
	}
	priority_queue<TP, vector<TP>, greater<TP>> pq;
	//????????????????????????????????¨??????????????????????????°
	d[s][able[s]] = cost[s];
	pq.push(maketp(cost[s], s, able[s]));
	while (pq.size()) {
		auto tmp = pq.top(); pq.pop();
		//cout << tmp.second.first << " " << tmp.second.second << " " << tmp.first << endl;
		if (d[tmp.second.first][tmp.second.second] < tmp.first)continue;
		for (int i = 0; i < e[tmp.second.first].size(); i++) {
			auto to = e[tmp.second.first][i];

			if (d[to][able[to]] > tmp.first + cost[to]) {
				if (to != g) {
					d[to][able[to]] = tmp.first + cost[to];
					pq.push(maketp(d[to][able[to]], to, able[to]));
				}
				else {
					d[to][able[to]] = tmp.first;
					pq.push(maketp(d[to][able[to]], to, able[to]));
				}
			}

			if (tmp.second.second != 1 && 
			d[to][tmp.second.second - 1] > tmp.first) {
				d[to][tmp.second.second - 1] = tmp.first;
				pq.push(maketp(d[to][tmp.second.second - 1], to, tmp.second.second - 1));
			}
		}
	}
	int res = 2000000000;
	for (int i = 0; i <= N; i++) {
		res = min(res, d[g][i]);
	}
	return res;
}

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> cost[i] >> able[i];
	}
	e.resize(N);
	for (int i = 0; i < K; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		e[a].push_back(b);
		e[b].push_back(a);
	}

	cout << djk(0, N - 1) << endl;

	return 0;
}

Measured memory_bytes: 101120
//Kyokai no Kanata //
#include<bits/stdc++.h>

using namespace std;

typedef long long int LL;
typedef pair<int,int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector< VI > VVI;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
  const char* comma=strchr(names+1,',');
  cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...)
#endif
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
float  inf=std::numeric_limits<double>::infinity();
LL INF=std::numeric_limits<LL>::max();
LL powm(LL base,LL power, LL mod){
  LL ret=1;
  while(power){
    if(power&1) ret=(ret*base)%mod;
    base=(base*base)%mod;
    power>>=1;
  } return ret;
}
int main(){
  int n,T,t,c,ans=100000; si(n);si(T);
  for(int i=0;i<n;i++){
    si(c);si(t);
    ans= min(ans,t<=T?c:100000);
  }
  if(ans!=100000)
  cout<<ans<<endl;
  else puts("TLE");
  return 0;
}


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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int a=100*r+10*g+b;
  if(a%4==0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

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

const int MAX_N = 255;
int n;
char grid[MAX_N][MAX_N];
int dp[MAX_N][MAX_N][4];

int main()
{
    while(cin >> n && n) {
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                cin >> grid[i][j];
        
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++) 
                for(int k = 0; k < 4; k++) 
                    dp[i][j][k] = 0;

        int ans = 0;
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                if(grid[i][j] == '0') {
                    for(int k = 0; k < 4; k++)
                        dp[i][j][k] = 0;
                } else {
                    dp[i][j][0] = (i > 0 && j > 0) ? dp[i-1][j-1][0] + 1 : 1;
                    dp[i][j][1] = (i > 0) ? dp[i-1][j][1] + 1 : 1;
                    dp[i][j][2] = (i > 0 && (j != n - 1)) ? dp[i-1][j+1][2] + 1 : 1;
                    dp[i][j][3] = (j > 0) ? dp[i][j-1][3] + 1 : 1;
                }
                for(int k = 0; k < 4; k++)
                    ans = max(ans, dp[i][j][k]);
            }
        }

        cout << ans << endl;
    }
}

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

int main(){
    int a, b, c, x;
    cin >> a >> b >> c;
    if(a > b){
        x = a;
        a = b;
        b = x;
        } 
    else{
    }     
    if(b > c){
        x = c;
        c = b;
        b = x;
        } 
    else{
    }     
    if(a > b){
        x = a;
        a = b;
        b = x;
        } 
    else{
    }     
    cout << a << " " << b << " " << c << endl;
    return 0;
}

Measured memory_bytes: 1164
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 一  9/ 4 18:28:20 2017
 *Ended  Time*  : 一  9/ 4 18:32:38 2017
*********************************************/
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;

int n;
int cnt[MaxN + 10];

int main(){
    while(~scanf("%d", &n)){
        int res = 0;
        for(int i = 1; i <= n; i++){
            int x;
            scanf("%d", &x);
            for(int j = 0; j <= 2; j++){
                cnt[x + j]++;
                res = max(res, cnt[x + j]);
            }
        }
        printf("%d\n", res);
        memset(cnt, 0, sizeof(cnt));
    }
    return 0;
}


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

struct Card{char suit, value;};

void bubble(struct Card A[], int N){
	for (int i=0; i < N; i++){
		for(int j=N -1;j >= i; j--){
			if (A[j].value < A[j - 1].value){
				Card t = A[j]; A[j] = A[j-1]; A[j - 1] = t;
			}
		}
	}
}

void selection(struct Card A[],int N){
	for (int i = 0; i < N; i++){
		int minj = i;
		for (int j= i; j < N; j++){
			if (A[j].value < A[minj].value) minj =j;
		}
		Card t = A[i]; A[i] = A[minj]; A[minj] = t;
	}
}

void print(struct Card A[], int N){
	for (int i=0; i < N; i++){
		if (i > 0) cout << " ";
		cout << A[i].suit << A[i].value;
	}
	cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N){
	for (int i = 0; i < N; i++){
		if (C1[i].suit != C2[i].suit) return false;
	}
	return true;
}

int main(){
	Card C1[100], C2[100];
	int N;
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> C1[i].suit >> C1[i].value;
	}
	for (int i = 0; i < N;i++) C2[i] = C1[i];
	
	bubble(C1, N);
	selection(C2, N);
	
	print(C1, N);
	cout << "Stable" << endl;

	print(C2, N);
	if (isStable(C1, C2, N)){
		cout << "Stable" << endl;
	}else {
		cout << "Not stable" << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
struct P {
    ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//??£??\???????????¨???
    ll to, cost;
};
struct S {//???????????±?????\???????????°
    int from, to, cost;
};
struct H {
    int x, y;
};
ll gcm(ll i, ll j) {//?????§??¬?´???°
    if (i > j) swap(i, j);
    if (i == 0) return j;
    return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
    return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad?????§?¨???????2??????????????¢
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n,k,x,sum=0;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>x;
		sum+=min(abs(x-k)*2,x*2);
	}
	cout<<sum<<endl;
    getchar(); getchar();
}


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

int main(){

  int n=0;
  cin>>n;
  
  int A[n];
  for(int k=0;k<n;k++){
	cin>>A[k];
  }
  int count=0;
  int flag=1;
  while(flag){
    rep(i,n){
		if(A[i]%2==0)A[i]/=2;
      else flag=0;
    }
    if(flag==1)count++;
  }

  cout<<count;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n >> m;
  n -= 2;
  m -= 2;
  if(n < 0)n = 1;
  if(m < 0)m = 1;
  print(n * m);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long

using namespace std;

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

    int n;
    cin >> n;

    int mx = 0;
    for (int i = 1; i * i <= n; i++)
        if (n % i == 0)
            mx = i;

    cout << mx + n / mx - 2 << '\n';

    return 0;
}

//      *   *  *****  *   *  *   *
//     *   *  *      **  *  *   *
//    *****  *****  * * *  *   *
//   *   *      *  *  **  *   *
//  *   *  *****  *   *   ***
//     *****  *****  *****
//    *      *   *  *
//   *      *****  *
//  *      *  *   *
//  ***** *   *   *****
	


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

bool pairCompare(const P & firstElof, const P & secondElof)
{
	return firstElof.second < secondElof.second;
}


int main() {
	//input
	int N;
	cin >> N;
	vector<ll> A(N), B(N);
	vector<P> P(N);
	rep(i, N) {
		cin >> A[i] >> B[i];
		P[i] = make_pair(A[i], B[i]);
	}
	sort(P.begin(), P.end(), pairCompare);

	ll ruiseki_A = 0;
	rep(i, N) {
		ruiseki_A += P[i].first;
		if (P[i].second >= ruiseki_A) {
			continue;
		}
		else {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

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


//constant----------------------------------------
const double EPS=1e-8;
const double INF=1e9;
const int COUNTER_CLOCKWISE=1;
const int CLOCKWISE=-1;
const int ONLINE_FRONT=2;
const int ONLINE_BACK=-2;
const int ON_SEGMENT=0;


typedef complex<double>Point;
typedef vector<Point>Polygon;
struct Line{
    Point p1,p2;
    Line(const Point &p1=Point(),const Point &p2=Point()):p1(p1),p2(p2){}
};
struct Segment{
    Point p1,p2;
    Segment(const Point &p1=Point(),const Point &p2=Point()):p1(p1),p2(p2){}
};
struct Circle{
    Point p;
    int r;
    Circle(const Point &p=Point(),int r=0.0):p(p),r(r){}
};

double Dot(Point &p1,Point &p2){
    return (conj(p1)*p2).real();
}

double Cross(Point &p1,Point &p2){
    return (conj(p1)*p2).imag();
}

int CCW(Point &p1,Point &p2,Point &p3){
    Point a=p2-p1,b=p3-p1;
    if(Cross(a,b)>EPS)return COUNTER_CLOCKWISE;
    if(Cross(a,b)<-EPS)return CLOCKWISE;
    if(Dot(a,b)<-EPS)return ONLINE_BACK;
    if(norm(b)>norm(a))return ONLINE_FRONT;
    return ON_SEGMENT;
}

signed main(){
    double x,y;
    scanf("%lf%lf",&x,&y);
    Point p1(x,y);
    scanf("%lf%lf",&x,&y);
    Point p2(x,y);

    int q;scanf("%d",&q);
    while(q--){
        scanf("%lf%lf",&x,&y);
        Point p3(x,y);
        if(CCW(p1,p2,p3)==COUNTER_CLOCKWISE)puts("COUNTER_CLOCKWISE");
        if(CCW(p1,p2,p3)==CLOCKWISE)puts("CLOCKWISE");
        if(CCW(p1,p2,p3)==ONLINE_BACK)puts("ONLINE_BACK");
        if(CCW(p1,p2,p3)==ONLINE_FRONT)puts("ONLINE_FRONT");
        if(CCW(p1,p2,p3)==ON_SEGMENT)puts("ON_SEGMENT");
    }
    return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
using PL = pair<ll, ll> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define mod 1000000007

ll modpow(ll a, ll n){
    if(n == 0) return 1 ;
    if(n == 1) return a % mod ;
    if(n % 2) return (a * modpow(a, n-1))%mod ;
    ll t = modpow(a, n/2) ;
    return (t*t) % mod ;
}

int main() {
    ll n ;
    cin >> n ;
    vector<ll> a (n) ;
    vector<ll> c (60) ;
    rep(i, n) {
        cin >> a[i] ;
        rep(j, 60){
            if(a[i] >> j & 1){
                c[j]++ ;
            }
        }
    }
    ll ans = 0 ;
    ll k =  n;
    rep(i, n){
        rep(j, 60){
            if(a[i] >> j & 1){
                ans += modpow(2,j)*(k - c[j]) ;
                ans %= mod ;
                c[j]-- ;
            }
            else {
                ans += modpow(2,j)*c[j] ;
            }
        }
        k-- ;
    }
    cout << ans << endl ;
} 

Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }

int gcd(int x, int y) { return y ? gcd(y,x%y) : x; }

int main(){
    int n,x; cin >> n >> x;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        a[i] = abs(a[i]-x);
    }
    int ans = 0;
    rep(i,n) ans = gcd(ans, a[i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
vector<int> v;
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    long long n,m,ans,z; cin>>n>>m;
    ans=min(n,m/2);
    m-=(ans*2);
    ans+=(m/4);
    cout<<ans;
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<int>v(n+1);
    int m = sqrt(n)+2;
    rep(x, 1, m){
        rep(y, 1, m){
            rep(z, 1, m){
                int p = x*x+y*y+z*z+x*y+y*z+z*x;
                if(p>n)continue;
                v[p]++;
            }
        }
    }
    rep(i, 1, n+1){
        cout << v[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


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

    vector<vector<int>> dp(n,vector<int>(n,0));
    for(int i = n-1; i >= 0; i--){
        for(int j = n-1; j >= 0; j--){
            if(s[i] == s[j]){
                if(i == n-1 || j == n-1){
                    dp[i][j] = 1;
                }else{
                    dp[i][j] = dp[i+1][j+1]+1;
                }
            }else{
                dp[i][j] = 0;
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            ans = max(ans, min(dp[i][j],abs(i-j)));
        }
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 98176
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int i,n,q;
    cin>>n>>q;
    queue<pair<string,int>> p;
    string s;
    int t;
    for(i=0;i<n;i++){
        cin>>s>>t;
        p.emplace(s,t);
    }
    t=0;
    pair<string,int> pr;
    while(!p.empty()){
        pr = p.front();
        p.pop();
        if(pr.second>q){
            t+=q;
            pr.second-=q;
            p.push(pr);
        }else{
            t+=pr.second;
            cout<<pr.first<<' '<<t<<'\n';
        }
    }
}


Measured memory_bytes: 6312
#include <stdio.h>
#define max 100
 
int arry[max][max];
int d[max],f[max];
int n,t=0;

void Depth(int);

int main(){
  int i,j,k,u,v;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      arry[u-1][v-1]=1;
    }
  }
  for(i=0;i<n;i++) if(d[i]==0)Depth(i);
 
  for(i=0;i<n;i++) printf("%d %d %d\n",i+1,d[i],f[i]);
  return 0; 
}

void Depth(int i){ 
  int j;
  t++;
  d[i]=t;
  for(j=0;j<n;j++)  if(arry[i][j]!=0 && d[j]==0)Depth(j);
  t++;
  f[i]=t;
}
 
 

Measured memory_bytes: 636
#include <stdio.h>
int main ()
{
	long long int n,a,i,sum=0;
	scanf("%lld",&n);
	for(i=0;i<n;i++)
	{
	scanf("%lld",&a);
	sum=sum+a;
	}
	printf("%lld\n",sum-n);
	return 0;
	
}

Measured memory_bytes: 1700
v, e, r = map(int, input().split()) # 頂点数v,辺数e,始点rを入力

g = [[] for i in range(v)] # グラフ

for i in range(e):
 s, t, d = map(int, input().split())
 g[s].append([t,d]) # sからtへの辺とその重みd


cost = ['INF' for i in range(v)] # 出力結果を初期化
cost[r] = 0
finish = [] # 最低コストが確定した頂点
finish.append(r)

import heapq
h = []

u = r # 新しく確定した頂点

for count in range(v-1):

 for adj in g[u]:
  if cost[ adj[0] ] != 'INF':
   continue

  new_cost = cost[u] + adj[1]
  heapq.heappush(h, (new_cost, adj[0]))
  

 while 1:
  if len(h) == 0:
   break

  minc = heapq.heappop(h)
  if cost[ minc[1] ] == 'INF':
   cost[ minc[1] ] = minc[0]
   u = minc[1]
   break

for i in range(v):
 print(cost[i])


Measured memory_bytes: 104124
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
    int N; cin >> N;
    vector<long long> a(N*3);
    for (int i = 0; i < N*3; ++i) cin >> a[i];

   
    vector<long long> S(N*2+1, 0);
    priority_queue<long long, vector<long long>, greater<long long> > que1;
    for (int i = 0; i < N; ++i) {
        S[i+1] = S[i] + a[i];
        que1.push(a[i]);
    }
    for (int i = N; i < N*2; ++i) {
        long long mi = que1.top();
        if (a[i] > mi) {
            S[i+1] = S[i] - mi + a[i];
            que1.pop();
            que1.push(a[i]);
        }
        else S[i+1] = S[i];
    }

   
    vector<long long> T(N*2+ 1, 0);
    priority_queue<long long> que2;
    for (int i = 0; i < N; ++i) {
        T[i+1] = T[i] + a[N*3-1 - i];
        que2.push(a[N*3-1 - i]);
    }
    for (int i = N; i < N*2; ++i) {
        long long ma = que2.top();
        if (a[N*3-1 - i] < ma) {
            T[i+1] = T[i] - ma + a[N*3-1 - i];
            que2.pop();
            que2.push(a[N*3-1 - i]);
        }
        else T[i+1] = T[i];
    }

   //左の消す個数をkこと固定しておく。それの最大をかんがえるので
  
    long long res = -(1LL<<60);
    for (int i = N; i <= N*2; ++i) {
        res = max(res, S[i] - T[N*3-i]);
    }
    cout << res << endl;
}


Measured memory_bytes: 8052
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;
using ull = unsigned long long;

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; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
constexpr long long mod = 998244353;
constexpr int MAX = 5000000;


int f(int a, int b) {
	return max(a, b);
}
template< typename Monoid >
struct SegmentTree {
	//using F = function< Monoid(Monoid, Monoid) >;

	int sz;
	vector< Monoid > seg;

	//const F f;
	const Monoid M1;

	SegmentTree(int n, /*const F f,*/ const Monoid& M1) : /*f(f),*/ M1(M1) {
		sz = 1;
		while (sz < n) sz <<= 1;
		seg.assign(2 * sz, M1);
	}

	void set(int k, const Monoid& x) {
		seg[k + sz] = x;
	}

	void build() {
		for (int k = sz - 1; k > 0; k--) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	void update(int k, const Monoid& x) {
		k += sz;
		seg[k] = x;
		while (k >>= 1) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	Monoid query(int a, int b) {
		Monoid L = M1, R = M1;
		if (a >= b) return M1;
		for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
			if (a & 1) L = f(L, seg[a++]);
			if (b & 1) R = f(seg[--b], R);
		}
		return f(L, R);
	}
};

int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n, k; cin >> n >> k;
	vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i];
	vector<int> dp(n + 1);
	SegmentTree<int> seg(MAX, -inf);
	for (int i = 0; i < n; i++) {
		{
			int req = max(a[i] - k, 0);
			int idx = seg.query(req, a[i] + 1);
			if (idx >= 0) chmax(dp[i + 1], dp[idx + 1] + 1);
		}
		{
			int req = a[i] + k;
			int idx = seg.query(a[i], req + 1);
			if (idx >= 0) chmax(dp[i + 1], dp[idx + 1] + 1);
		}
		chmax(dp[i + 1], 1);
		seg.update(a[i], i);
	}
	cout << *max_element(dp.begin(), dp.end()) << endl;
	return 0;
}

Measured memory_bytes: 71048
n,m=map(int,input().split())
d=[ input().split() for i in range(m)]
ans=[[0,0] for i in range(m+n+1)]
count=0
ac=0
wa=0

for i in range(m):
  if count!=d[i][0]:
    count=int(d[i][0])
  if d[i][1]=="WA" and ans[count][0]==0:
    ans[count][1]+=1
  elif d[i][1]=="AC" and ans[count][0]==0:
    ans[count][0]+=1
for i in range(n+m+1):
  ac+=int(ans[i][0])
  if int(ans[i][0])>=1:
    wa+=int(ans[i][1])
print(ac,wa)

Measured memory_bytes: 52608
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map as Map
import Data.Map (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToVector :: ByteString -> Vector Int
readIntToVector = Vector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToVectorN :: Int -> ByteString -> Vector.Vector Int
readIntToVectorN n = Vector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace


first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

main :: IO ()
main = do
	[n, k] <- readToListN 2 <$> BS.getLine :: IO [Int]
	hs <- readToListN n <$> BS.getLine :: IO [Int]
	let hs' = reverse . List.sort $ hs
	print $ sum $ drop k hs'


Measured memory_bytes: 32124
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A = Counter(A)

ideal = []
for i in range(1, N + 1):
    ideal.append(abs(N - 2 * i + 1))
ideal = Counter(ideal)

if dict(A) != dict(ideal):
    print(0)
else:
    print((2 ** (N // 2)) % (pow(10, 9) + 7))

Measured memory_bytes: 24740
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n;
    cin >> n;
    int ans = log2f(n);
    cout << pow(2,ans) << endl;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(){
  int i,y[100],j,temp,t;
  for(i=0;i<10;i++){
    scanf("%d",&y[i]);
  }
  for(i=0;i<9;i++){
  for(j=9;j>i;j--){
      if(y[j]>y[j-1]){
	temp=y[j];
	y[j]=y[j-1];
	y[j-1]=temp;
      }
    }
  }
  for(i=0;i<3;i++){
    printf("%d\n",y[i]);
  }
  return 0;
}

Measured memory_bytes: 0
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    S = readline().strip()

    dp = [[0] * (N + 1) for _ in range(N + 1)]
    ans = 0

    for i in range(N - 1, -1, -1):
        for j in range(i + 1, N):
            if S[i] == S[j]:
                dp[i][j] = dp[i + 1][j + 1] + 1
            if ans < min(dp[i][j], j - i):
                ans = min(dp[i][j], j - i)

    print(ans)
    return


if __name__ == '__main__':
    main()


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

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
*/

using namespace std;

#if DEBUG && !ONLINE_JUDGE
    #include "debug.h"
#else
    #define debug(...)
#endif

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<ll,ll> iil;
typedef vector<vector<int> > vvi;
typedef vector<vector<ii> > vvii;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define ff first
#define ss second
#define trav(a, x) for(auto& a : x) 
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
const ll INF = 1e18;
const int mod = 1e9 + 7;
ll gcd(ll a,ll b){if (a==0) return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return a*(b/gcd(a,b));}
ll Abs(ll a){if(a>0)return a;return -a;}
ll Ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
double Abs(double a){if(a>0)return a;return -a;}

//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1

//#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_NOde_update> 

inline int pow_(ll x, ll y,ll p){
  int r = 1; while(y){if(y & 1) r = r * x % p; y >>= 1; x = x * x % p;} return r;
}
inline int inv_(int x){return pow_(x, mod - 2, mod);}
inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int mul(int a, int b){return a * 1LL * b % mod;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}



int main()
{
	#ifdef LOCAL_TEST
	freopen("in.txt","r",stdin);
	//freopen("out.txt", "w", stdout);
	#else
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	#endif
	ll n,a,b;
	cin>>n>>a>>b;

	cout << min(n*a,b) << "\n";

	return 0;
}

Measured memory_bytes: 256
let () =
  let n, x = Scanf.scanf "%d %d\n" (fun n x -> n, x) in
  let mi = Array.init n (fun _ -> Scanf.scanf "%d\n" (fun x -> x)) in
  Array.sort (-) mi;
  let least = Array.fold_left (+) 0 mi in
  let count = (x - least) / mi.(0) in
  let res = n + count in
  Printf.printf "%d\n" res 
    


Measured memory_bytes: 2432
#include<stdio.h>
int main(){
  int N,i,j,minj,A[100],count=0,temp;
  
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);
  
  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(A[j] < A[minj]){
        minj = j;
      }
     }
    
    temp = A[i];
    A[i] = A[minj];
    A[minj] = temp;

    if(minj != i) count++;
  }
  
  for(i=0;i<N;i++){
    if(i != 0) printf(" ");
    printf("%d",A[i]);
    }
  printf("\n%d\n",count);
  
  return 0;
}



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

int main () {
    string S,ans;
    cin >> S;
    ans = "Yes";

    for (int i = 0; i < S.size(); i+=2) {
        if (S.at(i)=='L') {
            ans = "No";
            break;
        }

        if (i == S.size() - 1) {
            break;
        }

        int j = i+1;

        if (S.at(j)=='R' ) {
            ans = "No";
            break;
        }

        if (j == S.size() - 1) {
            break;
        }
    }

    cout << ans << endl;
}

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

const int mod = 998244353;

int main()
{
	int N;
	cin >> N;
	vector<int> D(N);
	for (int i = 0; i < N; i++) {
		cin >> D[i];
	}
	if (count(D.begin(), D.end(), 0) != 1 || D[0] != 0) {
		cout << 0 << endl;
		return 0;
	}
	map<int, int> cnt;
	for (int i = 0; i < N; i++) {
		++cnt[D[i]];
	}
	ll res = 1;
	for (auto p : cnt) {
		if (p.first == 0) continue;
		for (int i = 0; i < p.second; i++) {
			(res *= cnt[p.first - 1]) %= mod;
		}
	}
	cout << res << endl;
	return 0;
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

template<typename T>
bool chmin(T &a, T b){
    if(a > b){
        a = b;
        return true;
    }else{
        return false;
    }
}

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

    int n, m;
    cin >> n >> m;

    vector<int> a(m), b(m);
    rep(i, m){
        cin >> a[i] >> b[i];
    }

    int ans = IINF;
    rep(i, m){
        int t = 0;
        rep(j, m){
            if(i == j){
                continue;
            }
            t += max(b[j] - n, 0);
        }
        chmin(ans, t);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3176
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll n,x;
    cin>>n;
    vector<pii> v;
    ll ans[n+1];
    memset(ans,0,sizeof(ans));
    rep(i,1,n){
        cin>>x;
        v.pb({x,i});
    }
    sort(all(v));
    rep(i,0,n-1){
        ans[i+1]=v[i].S;
    }
    rep(i,1,n) cout<<ans[i]<<" ";
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 3312
#include <bits/stdc++.h>
#define LL int
using namespace std;
const int mod = 998244353;
const int maxn = 3010;
int dp[maxn],a[maxn];
void add(int &x ,int y){
  x+=y;
  if(x>=mod) x-=mod;
}
int main(){
  	int n,s,x;
  	cin>>n>>s;
  	for (int i=1;i<=n;i++) cin>>a[i];
  	sort(a+1,a+1+n);
  
  	dp[0] = 1;
  	for (int i=1;i<=n;i++){
      x=a[n-i+1];
      for (int j=s;j>=x;j--){
      	add(dp[j],dp[j]);
        add(dp[j],dp[j-x]);
      }
      add(dp[0],dp[0]);
    }
  	cout<<dp[s]<<endl;
	return 0;
}

Measured memory_bytes: 3636
/*
*
*   Bismillah Hir Rahman Nir Raheem
*   Name: Jaied Al Sabid
*
*/

#include <iostream>
#include <string>
#include <bits/stdc++.h>

using namespace std;

#define pf printf
#define sf scanf
#define elif else if
#define unint unsigned int
#define sint short int

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    string inpString;
    cin>>inpString;
    sint x,num=0;
    x = inpString.size();
    for(int i = 0; i<x; i++)
    {
        if(inpString[i] != inpString[x-1-i])
        {
            num++;
        }
    }
    cout<<num/2;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
int N;
int a[100001];
int inde=0;
int m=1000000005;
int c=0;
int main(){
	cin >> N;
	for(int i=0;i<N;i++)cin >> a[i];
	while(1){
		c=0;
		for(int i=0;i<N;i++){
			if(a[i]!=0)c++;
			if(a[i]<m && a[i]!=0){m=a[i];inde=i;}
		}
		if(c==1)break;
		for(int i=0;i<N;i++){
			if(i!=inde)a[i]%=m;
		}
	}
	cout << m << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <stdio.h>
#include <tuple>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <stack>
#include <set>
//#include <complex>
#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222
#define fauto(it, c) for(__typeof((c).begin())  it=(c).begin();it!=(c).end();it++)

using namespace std;
//using namespace __gnu_pbds;
 
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}
 
//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};


int main()
{
 	ll a, b;
 	cin >> a >> b;
 	a += b;
 	if(a & 1)
 		cout << "IMPOSSIBLE";
 		else
 			cout << a/2;		


		

}

















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();
    
    int h, a, b;
    cin >> h >> a >> b;

    int ans = 0;
    eFOR(i, a, b)if (h % i == 0)ans++;
    cout << ans << "\n";
}


Measured memory_bytes: 3236
require 'matrix'

h, w, k = gets.split.map(&:to_i)
rows = Array.new(h){gets.chomp.bytes}
cnt = 0
[0, 1].repeated_permutation(h).each do |x|
  m = Matrix.rows(rows.dup.shift(h))
  x.each_with_index do |y, i|
    next if y == 0
    w.times do |j|
      m[i, j] = '.'.ord
    end
  end
  [0, 1].repeated_permutation(w) do |u|
    mc = m.dup
    u.each_with_index do |v, j|
      next if v == 0
      h.times do |i|
        mc[i, j] = '.'.ord
      end
    end
    cnt += 1 if mc.count('#'.ord) == k
  end
end
puts cnt

Measured memory_bytes: 15184
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;


int main() {
    int n,k; cin >> n >> k;
    int ans = k;
    rep(i,n-1) {
        ans *= k-1;
    }
    cout << ans << endl;
} 

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

signed main(){
  int n;cin>>n;
  vector<int> v(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>v[i];sum^=v[i];
  }
  for(int i=0;i<n;i++)cout<<(sum^v[i])<<" ";
}


Measured memory_bytes: 3952
import itertools

A = []
for i in range(3):
  A_i = list(map(int, input().split()))
  A.append(A_i)
  
A = list(itertools.chain.from_iterable(A))
N = int(input())

for _ in range(N):
  b = int(input())
  for i, a in enumerate(A):
    if a == b:
      A[i] = 0
      break
  if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8] or A[0] == A[4] == A[8] or A[2] == A[4] == A[6]:
    print('Yes')
    exit()

print('No')

Measured memory_bytes: 3064
S = input()
L = len(S)
n = 0

for i in range(L):
  if (L - (i + 1)) % 2 == 0:
    M = int((L - i - 1) / 2)
    if S[:M] == S[M:L-1-i]:
      n = L-1-i
      break
print(n)


Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<set>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	
	int max1=0;
	for(int i=0;i<n;i++)
	{
		set<char> S1,S2;
		int ans=0;
		for(int j=0;j<=i;j++)
		{
			S1.insert(s[j]);
		}
		for(int j=i+1;j<n;j++)
		{
			S2.insert(s[j]);
		}
		for(set<char>::iterator it = S1.begin();it != S1.end();it++)
	   {
		if(S2.count((*it))) ans++;
	    }
	    if(ans>max1) max1=ans;
	}
	cout<<max1<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 1e9 + 7;

int main() {
    int n; cin >> n;
    vector<int> buf;
    buf.push_back(1); 
    for (int i = 6; i <= n; i *= 6) buf.push_back(i); 
    for (int i = 9; i <= n; i *= 9) buf.push_back(i); 
    sort(all(buf)); 
    vector<int> dp(n+1, numeric_limits<int>::max());
    for (int c :buf) {
        for(int i = c; i <= n; ++i) {
            if (i==c) dp[i] = 1;
            else dp[i] = min(dp[i], dp[i-c]+1);
        }
    } 
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int w, a, b;
    cin >> w >> a >> b;
    int x = min(a, b);
    int y = max(a, b);

    int ans = 0;
    if(y-x<=w){
        ans = 0;
    }
    else{
        ans = y-x-w;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#define ll long long
using namespace std;

int main(){
  
  int N;
  cin >> N;
  ll A[N];
  ll multi = 1;

  bool can = false;
  ll cant = pow(10,18);
  for (int i=0; i<N; i++){
    cin >> A[i];
    if (A[i] == 0) {cout << 0 << endl; return 0;}
  }

  for (int i=0; i<N; i++){
    if (cant/A[i] < multi) {can = true; break;}
    multi *= A[i];
  }
  
  if (can) cout << "-1" << endl;
  else cout << multi << endl;
  
  return 0;
}


Measured memory_bytes: 3940