akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

#define zton(i,n) for(int i=0;i<=n;i++)
#define oneton(i,n) for(int i=1;i<=n;i++)
#define fo(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<b;i++)
#define loop(i,b,a) for(int i=a;i>=b;i--)
#define dsort(arr,n) sort(arr, arr + n, greater<int>())
#define vsortd(a) sort(a.begin(), a.end(), greater<double>())
#define vsort(a) sort(a.begin(), a.end())
#define ll long long int
#define test int tc;cin>>tc;while(tc--)
#define dbg(x) cout<<#x<<'='<<(x)<<endl;
#define dbg2(x,y) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl;
#define dbg3(x,y,z) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl;
#define dbg4(x,y,z,w) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl<<#w<<"="<<(w)<<endl;
#define minheap priority_queue <int, vector<int>, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define mpr make_pair
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mkv vector<int>
#define allzero(dp) memset(dp,0,sizeof(dp))
#define endl "\n"
#define print(x) cout<<x<<endl;

const int mod=1e9+7;
using namespace std;
bool sortcol( const vector<int>& v1,const vector<int>& v2 ) {return v1[1] < v2[1];}

void fastio()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

bool compare(const pair<ll,ll> &a,const pair<ll,ll> &b){
    if(a.first>b.first)return true;
    if(a.first==b.first)return a.second<b.second;
    return false;
}

ll power(ll x, ll y){
    ll res = 1;x=x%mod;
    while(y>0){
        if(y&1)res=(res*x)%mod;
        y=y>>1;x=(x*x)%mod;}
    return res;
}

mkv vin(int n){
    mkv v;
    fo(i,n){
        int t;cin>>t;v.pb(t);
    }
    return v;
}

vector<int>ch;
const int N=2e5+10;
vector<int>v[N];
int vis[N];
int cnt=0;

void dfs(int x)
{
    cnt++;
    vis[x]=1;
    for(int i=0;i<v[x].size();i++){
        if(!vis[v[x][i]]){
            dfs(v[x][i]);
        }
    }
}
void solve()
{
    int n,m;cin>>n>>m;
    fo(i,m){
        int x,y;cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    int mx=0;
    for(int i=1;i<=n;i++){
        if(!vis[i]){
            cnt=0;
            dfs(i);
            mx=max(mx,cnt);
        }
    }
    print(mx)

}

int main()
{
  //  fastio();
//    test
    solve();
}


Measured memory_bytes: 21476
#define _AOJ_
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long long lint;
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,a,b) for(int i=a;i<b;++i)

int main(){
	lint n;cin>>n;
	vector<lint>a(n);
	lint mx=0;
	rep(i,n)cin>>a[i],mx=max(mx,a[i]);
	set<lint> s;
	for(int i=1;i*i<=mx;++i){
		if(mx%i==0){
			if(i*i==mx)s.insert(i);
			else s.insert(i),s.insert(mx/i);
		}
	}
	lint ans=0;
	rep(i,n){
		ans+=*s.lower_bound(a[i])-a[i];
	}
	cout<<ans<<endl;
}
//sub-EOF


Measured memory_bytes: 3620
/* ****GT_18**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll n;
		cin>>n;
		ll a[n];
		rep(i,0,n)cin>>a[i];
		sort(a,a+n);
		ll ans=0;
		rep(i,0,n-2){
			rep(j,i+1,n-1){
				rep(k,j+1,n){
					if(a[i]!=a[j] and a[j]!=a[k] and a[i]!=a[k] and a[i]+a[j]>a[k])ans++;
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

int main() {
  string s,t; cin>>s>>t;
  for(int i=0; i<s.size(); i++){
    if(s==t) {
      cout<<"Yes";
      return 0;
    }
    s = s.back() + s.substr(0,s.size()-1);
  }
  cout<<"No";
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void)
{
    string s;
    int cnt=0;
    cin >> s;
    for(int i=0;i<=1;i++)
    {
        if(s[i]!=s[i+1])
            cnt++;
    }
    if(cnt>=1)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: i,n,cnt,na
    integer(int64), allocatable:: a(:)

    read*, n
    allocate(a(n))
    do i=1,n
        read*, a(i)
    end do

    cnt=0
    na = a(n)
    if (a(1) /= 0) then
        print'(i0)', -1
        stop
    end if
    do i=n,2,-1
        ! print*, i, a(i-1) == a(i)-1
        if (a(i-1) == a(i)-1) then
            cnt=cnt+1
            na=na-1
            cycle
        end if
        if (a(i) < na) then
            print'(i0)', -1
            stop
        end if
        cnt=cnt+a(i)
        na = a(i)
    end do
    print'(i0)', cnt
end program main

Measured memory_bytes: 4476
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  if (x < 1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

bool check(string s) {
    int n = s.size();
    string pre = s.substr(0,n/2);
    string back = s.substr(n/2);
    return pre == back;
}

int main() {
    string s; cin >> s;
    int n = s.size();
    for (int i = n-2; i >= 1; i -= 2) {
        string tmp = s.substr(0,i);
        if (check(tmp)) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

// array pointer = *a, num of element = n, key key
int lower_bound(int *a, int n, int key){
    int ng, mid, ok;
    ng = -1, ok = n-1;
    while (abs(ok - ng) > 1){
        mid = (ok + ng) / 2;
        if (key <= a[mid]){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    if (a[ok] >= key)return ok;
    return n;
}

//greatest common divisor
unsigned long gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}

unsigned long lcm(unsigned long x, unsigned long y){
    unsigned long g = gcd(x, y);
    return x*y/g;

}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}




/*unsigned long long pascal[100][100] = {0};
void make_pascal(void){
    for (int i = 0; i < 100; i++){
        pascal[i][0] = 1;
    }
    pascal[1][1] = 1;
    for (int i = 2; i < 100; i++){
        for (int j = 1; j < 100; j++){
           pascal[i][j] = (pascal[i-1][j-1]+pascal[i-1][j]) % mod;
        }
    }
}*/
long long mod = 1000000007;

//x ^ n
long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % mod;
        x = x * x % mod;
    }
    return res;
}

/*int struct_ascending_compare(const void *p, const void *q) {
    return ((structname*)p)->member - ((strcutname*)q)->member;
}*/

char field[4][4];

int main(void){
    long long n, m;
    long long ans;
    scanf("%lld %lld", &n, &m);
    ans = llabs(n-2)*llabs(m-2);
    printf("%lld\n", ans);
    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p;
    cin >> k >> x;
    if(500 * k >= x){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}


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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

ll a, b;

void input(){
    cin >> a >> b;
}

ll Xor(ll num){
    if(num%2) return num % 4 == 1;
    return num + (num % 4 == 2);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    cout << (Xor(a-1)^Xor(b)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;
    out(800*n - (n/15)*200);
    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007


int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<vector<int>> data(N, vector<int>(M+1));
  int ans=10000000
  rep(i, N){
  rep(j, M+1){
  cin >> data[i][j];
  }
  }
  rep(i, 2){
  rep(i2, 2){
  rep(i3, 2){
  
  rep(i4, 2){
  
  rep(i5, 2){
  
  rep(i6, 2){
  
  rep(i7, 2){
  
  rep(i8, 2){
  
  rep(i9, 2){
  
  rep(i10, 2){
  
  rep(i11, 2){
  
  rep(i12, 2){
    
  vector<int> check(M, X);
int kari=0;
    if(i==0&&N>=1){
    kari+=data[0][0];
      rep(j, M)
        check[j]-=data[0][j+1];
    }    
    if(i2==0&&N>=2){
    kari+=data[1][0];
      rep(j, M)
        check[j]-=data[1][j+1];
    }    
    if(i3==0&&N>=3){
    kari+=data[2][0];
      rep(j, M)
        check[j]-=data[2][j+1];
    }    
    if(i4==0&&N>=4){
    kari+=data[3][0];
      rep(j, M)
        check[j]-=data[3][j+1];
    }    
    if(i5==0&&N>=5){
    kari+=data[4][0];
      rep(j, M)
        check[j]-=data[4][j+1];
    }    
    if(i6==0&&N>=6){
    kari+=data[5][0];
      rep(j, M)
        check[j]-=data[5][j+1];
    }    
    if(i7==0&&N>=7){
    kari+=data[6][0];
      rep(j, M)
        check[j]-=data[6][j+1];
    }   
    if(i8==0&&N>=8){
    kari+=data[7][0];
      rep(j, M)
        check[j]-=data[7][j+1];
    }    
    if(i9==0&&N>=9){
    kari+=data[8][0];
      rep(j, M)
        check[j]-=data[8][j+1];
    }   
    if(i10==0&&N>=10){
    kari+=data[9][0];
      rep(j, M)
        check[j]-=data[9][j+1];
    }    
    if(i11==0&&N>=11){
    kari+=data[10][0];
      rep(j, M)
        check[j]-=data[10][j+1];
    }   
    if(i12==0&&N>=12){
    kari+=data[11][0];
      rep(j, M)
        check[j]-=data[11][j+1];
    }
    int a=0;
    rep(i, M)
    {if(check[i]>0)
      a++;
    }
    if(a==0)
      ans=min(ans, kari);
  }
  }
  }
  }
  }
  }
  }
  }
  }
  }
  
  }
  
  }
  if(ans!=10000000)
  cout << ans << endl;
  else 
    cout << -1 << endl;
}


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

#define int long long
#define MOD 998244353


template <class Monoid> struct SegmentTree{
	using Func = function<Monoid(Monoid, Monoid)>;

	int size;
	vector<Monoid> seg;
	const Func merge;
	const Monoid def;

	SegmentTree(int n, Monoid d, const Func f): merge(f), def(d){
		for(size = 1; size <= n; size <<= 1);
		seg.assign(size*2, def);
	}

	Monoid& operator[] (int i) { return seg[i+size]; };
	void build(){ for(int i = size-1;i >= 0;i--) seg[i] = merge(seg[i*2], seg[i*2+1]); }

	void update(int i, Monoid val){
		seg[i += size] = val;
		while(i >>= 1) seg[i] = merge(seg[i*2], seg[i*2+1]);
	}

	void add(int i, Monoid val){ update(i, val+seg[i+size]); }

	Monoid get(int a, int b){
		Monoid l = def, r = def;
		for(a += size, b += size; a < b; a >>= 1, b >>= 1){
			if(a & 1) l = merge(l, seg[a++]);
			if(b & 1) r = merge(seg[--b], r);
		}
		return merge(l, r);
	}
};

SegmentTree<int> seg(200010, INT_MIN, [](int a, int b){ return max(a, b);});

int n;
int memo[200010];
int dp(int i){
	if(i == n) return 1;
	if(memo[i] != -1) return memo[i];
	int ans = (dp(i+1) + dp(seg[i])) % MOD;
	return memo[i] = ans;
}

signed main(){
	cin >> n;
	vector<pair<int, int>> vec;
	vector<int> vec2;

	for(int i = 0;i < n;i++){
		int x, d;
		cin >> x >> d;
		vec.push_back({x, d});
		vec2.push_back(x);
	}

	sort(vec.begin(), vec.end());
	sort(vec2.begin(), vec2.end());

	for(int i = 0;i < n;i++){
		seg[i] = i+1;
	}

	seg.build();

	for(int i = n-1;i >= 0;i--){
		int idx = lower_bound(vec2.begin(), vec2.end(), vec[i].first+vec[i].second) - vec2.begin(); 
		int num = seg.get(i, idx);
		seg.update(i, num);
	}

	memset(memo, -1, sizeof(memo));

	cout << dp(0) << endl;

	return 0;
}


Measured memory_bytes: 20076
#include<bits/stdc++.h>
#define taskname "abc126_a"
using namespace std;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);   cout.tie(nullptr);
    if (ifstream("test.inp"))
    {
        freopen("test.inp", "r", stdin);
        #ifdef CHECKING
            freopen(taskname".out", "w", stdout);
        #else
            freopen("test.out", "w", stdout);
        #endif //CHECKING
    }
    else if (ifstream(taskname".inp"))
    {
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }

    int n, k;
    string s;
    cin >> n >> k >> s;
    if (s[k-1] < 97) s[k-1] += 32;
    cout << s;
}


Measured memory_bytes: 3644
#include<iostream>
using namespace std;
int main(){

    int n;
    while(cin>>n,n){
        int most = 0;
        int least = 10000;
        for(int i=0;i<n;i++){
            int x=0;
            for(int j=0;j<5;j++){
                int y;
                cin>>y;
                x+=y;
            }
            if(x>most)most = x;
            if(x<least)least = x;

        }
        cout<<most<<" "<<least<<endl;

    }
    return 0;
}

Measured memory_bytes: 1160
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll n;
cin>>n;
vector<ll>v;
for(ll i=0;i<n;i++)
{
    ll a;
    cin>>a;
    v.pb(a);
}
ll ans=0;
ll x=v[0];
for(ll i=0;i<n;i++)
{
    if(x>=v[i])
    {
        ans++;
    }
    x=min(x,v[i]);
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
using ii = pair<int, int>;
 
void solve();
 
clock_t start_time;
double get_current_time() {
	return (double)(clock() - start_time) / CLOCKS_PER_SEC;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	solve();
}
 
/* ========== actual code starts here ========== */
 
#define fi first
#define re return
#define se second
#define in insert
#define pb push_back
#define eb emplace_back
#define y1 y123123123123
#define all(x) x.begin(), x.end()
 
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repx(i, x, n) for (int i = x; i < (n); i++)
#define repd(i, n, d) for (int i = 0; i < (n); i += d)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepd(i, n, d) for (int i = (n) - 1; i >= 0; i -= d)
 
#ifdef artem
	#define debug(x) x
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define debug(x)
#endif

const int limit = 1e4;
const int MAXN = 55;
 
void solve() {
	int n, a;
	cin >> n >> a;
	vector<int> x(n), cnt(MAXN);
	rep(i, n) {
		cin >> x[ i ];
		cnt[ x[ i ] ]++;
	}

	vector<vector<vector<ll>>> dp(n + 1, vector<vector<ll>>(n + 1, vector<ll>(limit)));
	dp[ 0 ][ 0 ][ 0 ] = 1;
	repx(i, 0, n) {
		for(int c = 0; c <= i; c++) {
			for(int j = 0; j < limit; j++) {
				if(dp[ i ][ c ][ j ] == 0) continue;
				dp[ i + 1 ][ c + 1 ][ j + x[ i ] ] += dp[ i ][ c ][ j ];
			}
			for(int j = 0; j < limit; j++) {
				if(dp[ i ][ c ][ j ] == 0) continue;
				dp[ i + 1 ][ c ][ j ] += dp[ i ][ c ][ j ];
			}
		}
	}

	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		if(a * i < limit) {
			ans += dp[ n ][ i ][ a * i ];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 210652
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

typedef long long ll;

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

// const int C ;
// const int M = 1000000007;

int main () {
  int N;
  cin >> N;
  int x[110];
  fill(x, x+110, 0);
  int m = 200;
  for (auto i = 0; i < N; i++) {
    int a;
    cin >> a;
    x[a]++;
    m = min(m, a);
  }
  if (x[m] >= 3) {
    cout << "Impossible" << endl;
    return 0;
  } else if (x[m] == 2) {
    for (auto i = m+1; i <= 2*m-1; i++) {
      if (i >= 110 || x[i] < 2) {
        cout << "Impossible" << endl;
        return 0;
      }
    }
    for (auto i = 2*m; i < 110; i++) {
      if (x[i] != 0) {
        cout << "Impossible" << endl;
        return 0;
      }
    }
  } else {
    for (auto i = m+1; i <= 2*m; i++) {
      if (i >= 110 || x[i] < 2) {
        cout << "Impossible" << endl;
        return 0;
      }
    }
    for (auto i = 2*m+1; i < 110; i++) {
      if (x[i] != 0) {
        cout << "Impossible" << endl;
        return 0;
      }
    }
  }
  cout << "Possible" << endl;
}


Measured memory_bytes: 384
import random
import time

# 処理前の時刻
t1 = time.time() 

def f_last(d, i, lt):
  idx = []
  if i in lt[0:d]:
    idx = [j+1 for j, x in enumerate(lt[0:d]) if x == i]
  else:
    idx.append(0)
  return idx[-1]

d = int(input())
lc = list(map(int, input().split()))
ls = []
for _ in range(d):
  ls.append(list(map(int, input().split())))

v_max = -(10**5)
lt_max = [1]*d
while 1:
  lt = [random.randint(1, len(lc)) for i in range(d)]
  v = 0
  for dd in range(1, d+1):
    v_d = 0
    for i in range(len(lc)):
      v_d += lc[i]*(dd-f_last(dd, i+1, lt))
    v = v + ls[dd-1][lt[dd-1]-1] - v_d
  if v_max < v:
    v_max = v
    lt_max = lt[:]
  t2 = time.time()
  if t2-t1 > 1.85:
    break

for t in lt_max:
  print(t)

Measured memory_bytes: 9804
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
#define N 200003
#define LL long long
#define mod 998244353

int n;
int a[N],b[N];
LL ans;

inline int read(){
	int X=0,w=0;
	char ch=0;
	while (ch<'0' || ch>'9')
	  w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9')
	  X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
	return w ? -X : X;
}

int main(){
	n=read();
	for (int i=1;i<=n+1;i++)
	  a[i]=read();
	for (int i=1;i<=n;i++)
	  b[i]=read();
	ans=0;
	for (int i=1;i<=n;i++){
		if (b[i]>=a[i]){
			ans+=a[i];
			b[i]-=a[i];
			if (b[i]>=a[i+1]){
				ans+=a[i+1];
				a[i+1]=0;
			}
			else{
				ans+=b[i];
				a[i+1]-=b[i];
			}
		}
		else ans+=b[i];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N, long long M, long long P, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C){
  REP(M){
    --A[i];--B[i];
    C[i]-=P;
    C[i]=-C[i];
  }

  vector<vector<pll>> m(N,vector<pll>());
  vector<vector<ll>> invm(N,vector<ll>());
  REP(M){
    m[A[i]].push_back(pll(B[i],C[i]));
    invm[B[i]].push_back(A[i]);
  }
  deque<ll> q;
  vector<bool> used(N,false);
  q.push_back(N-1);
  while(!q.empty()){
    auto tmp=q.back();q.pop_back();
    if(used[tmp]==false){
      used[tmp]=true;
      for (auto &&j : invm[tmp])
      {
        q.push_back(j);
      }
    }
  }
  vector<bool> used2(N,false);
  q.push_back(0);
  while(!q.empty()){
    auto tmp=q.back();q.pop_back();
    if(used2[tmp]==false){
      used2[tmp]=true;
      for (auto &&j : m[tmp])
      {
        q.push_back(j.first);
      }
    }
  }
  REP(N){
    if(used2[i]==false){
      used[i]=false;
    }
  }
  auto bellmanford=[&](){
    vector<ll> ret(N,LLONG_MAX>>4);
    ret[0]=0;
    For(times,N){
      REP(N){
        if(used[i]==false)continue;
        for (auto &&j : m[i])
        {
          if(used[j.first]==false)continue;
          ret[j.first]=min(ret[j.first],ret[i]+j.second);
        }
      }
    }
    REP(N){
      if(used[i]==false)continue;
      for (auto &&j : m[i])
      {
        if(used[j.first]==false)continue;
        if(ret[i]+j.second<ret[j.first]){
          cout<<-1<<endl;
          exit(0);
        }
      }
    }
    return move(ret);
  };
  auto ans=bellmanford();
  cout<<max(0LL,-ans[N-1])<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long P;
    scanf("%lld",&P);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    std::vector<long long> C(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
        scanf("%lld",&C[i]);
    }
    solve(N, M, P, std::move(A), std::move(B), std::move(C));
    return 0;
}


Measured memory_bytes: 768
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException{
		final int DATAMAX = 10;
		int a[] = new int[DATAMAX];
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		for (int i = 0; i < DATAMAX; i++) {
			a[i] = Integer.parseInt(br.readLine());
		}
		for (int i = 0; i < DATAMAX; i++) {
			for (int j = i+1; j < DATAMAX; j++) {
				if (a[i] < a[j]) {
					int tmp = a[i];
					a[i] = a[j];
					a[j] = tmp;
				}
			}
		}
		for (int i = 0; i < 3; i++) {
			System.out.println(a[i]);
		}
	}
}

Measured memory_bytes: 24180
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

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

int main()
{
    string s;
    cin >> s;
    if(s[0] == s[2])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

int main() {
    int n, x, t;
    cin >> n >> x >> t;

    if (n % x == 0) {
        cout << n / x * t << endl;
    } else {
        cout << (n / x + 1) * t << endl;
    }

    return 0;
}


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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>
#define mod 998244353

int lowbit(int x) {return x&(-x);}

int n;
ll a[3010];
ll dp[3010][3010][2];

ll getf(int l,int r,int c) {
	if (dp[l][r][c]!=-1) return dp[l][r][c];
	if (l==r) {
		if (c==0) return dp[l][r][c]=a[l];
		else return dp[l][r][c]=-a[l];
	}
	if (c==0) dp[l][r][c]=max(a[l]+getf(l+1,r,1),a[r]+getf(l,r-1,1));
	else dp[l][r][c]=min(getf(l+1,r,0)-a[l],getf(l,r-1,0)-a[r]);
	return dp[l][r][c];
}

int main(){
	memset(dp,-1,sizeof(dp));
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	cout<<getf(1,n,0);
	return 0;
}


Measured memory_bytes: 142080
function main()
n = parse(Int, readline())
a = readline()
b = readline()
c = readline()

result = 0
for i = 1:n
    if a[i] == b[i] && b[i] == c[i]
        continue
    elseif a[i] == b[i] || b[i] == c[i] || a[i] == c[i]
        result += 1
    else
        result += 2
    end
end

print(result)
end

main()

Measured memory_bytes: 108040
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>

#define MAX_LEN 1000000

using namespace std;

void printArray1(int *data, int len)
{
	for (int i = 0; i < len; i++)
	{
		printf("%d", data[i]);
		if (i != len - 1) printf(" ");
	}
	printf("\n");
}

void printArray2(int *data, int len)
{
	for (int i = 0; i < len; i++)
	{
		printf("%d\n", data[i]);
	}
}

void swap(int *a, int i, int j)
{
	int temp;
	temp = a[i];
	a[i] = a[j];
	a[j] = temp;
}

struct card
{
	int n;
	char c;
};

void printArray(card *cards, int len)
{
	for (int i = 0; i < len; i++)
	{
		printf("%c", cards[i].c);
		printf("%d", cards[i].n);
		if (i != len - 1) printf(" ");
	}
	printf("\n");
}

void swap(card *cards, int i, int j)
{
	card temp;
	temp = cards[i];
	cards[i] = cards[j];
	cards[j] = temp;
}

int compare(card c1, card c2)
{
	if (c1.n < c2.n)
	{
		return -1;
	}
	else if (c1.n == c2.n)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}

bool isSame(card *cards1, card *cards2, int len)
{
	for (int i = 0; i < len; i++)
	{
		if (cards1[i].n != cards2[i].n)return false;
		if (cards1[i].c != cards2[i].c)return false;
	}
	return true;
}

void BubbleSort(card *cards, int len, int(*compare)(card, card))
{
	for (int i = 0; i < len - 1; i++)
	{
		for (int j = len - 1; j > i; j--)
		{
			if (compare(cards[j - 1], cards[j]) > 0)
			{
				swap(cards, j - 1, j);
			}
		}
	}
}

void SelectionSort(card *cards, int len, int(*compare)(card, card))
{
	for (int i = 0; i < len - 1; i++)
	{
		int min = i;
		for (int j = i + 1; j < len; j++)
		{
			if (compare(cards[j], cards[min]) < 0)
			{
				min = j;
			}
		}
		swap(cards, i, min);
	}
}

int g[MAX_LEN];
int m = 0;
int cnt = 0;

void insertSort(int *data, int len, int g)
{
	for (int i = g; i < len; i++)
	{
		int v = data[i];
		int j = i;
		while (j >= g && data[j - g] > v)
		{
			data[j] = data[j - g];
			j -= g;
			cnt++;
		}
		data[j] = v;
	}
}

void shellSort(int *data, int len)
{
	int v;
	for (v = 1; v * 3 + 1 < len; v = 3 * v + 1);
	for (int i = 0; i < len && v > 0; i++, v /= 3)
	{
		g[i] = v;
		m++;
	}
	for (int i = 0; i < m; i++)
	{
		insertSort(data, len, g[i]);
	}
}

int input_data[MAX_LEN];

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

	for (int i = 0; i < len; i++)
	{
		scanf("%d", &input_data[i]);
	}

	shellSort(input_data, len);
	printf("%d\n", m);
	printArray1(g, m);
	printf("%d\n", cnt);
	printArray2(input_data, len);

}


Measured memory_bytes: 7052
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<algorithm>
using namespace std;
#define ll long long
#define re register
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
int n,v[100010];
struct node{
	int num,val;
	bool operator<(const node b)const{
		return num>b.num;
	}
}b1[100010],b2[100010];
int main(){
	n=gi();
	for(re int i=1;i<=n;i++)v[i]=gi();
	for(re int i=1;i<=n;i+=2){
		b1[v[i]].num++;
		b1[v[i]].val=v[i];
	}
	for(re int i=2;i<=n;i+=2){
		b2[v[i]].num++;
		b2[v[i]].val=v[i];
	}
	sort(b1+1,b1+100000+1);sort(b2+1,b2+100000+1);
	int Val1=b1[1].val,Val2=b2[1].val;
	int num1=b1[1].num+b2[2].num,num2=b1[2].num+b2[1].num;
	if(Val1!=Val2){
		printf("%d\n",n-b1[1].num-b2[1].num);return 0;
	}
	else if(num1<num2){
		printf("%d\n",n-num2);
		return 0;
	}
	else{
		printf("%d\n",n-num1);
		return 0;
	}
	return 0;
}


Measured memory_bytes: 2176
#include<stdio.h>
#include<stdlib.h>
int fun(int ,int );
int fun(int A,int B)
{
    if(A%3==0||B%3==0||(A+B)%3==0)
    {
        return 1;
    }
    return 0;
}
int main()
{
    int A,B;
    scanf("%d%d",&A,&B);
    printf((fun(A,B)==1)?"Possible\n":"Impossible\n");
    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef
tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long long ll;
typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
}

void solve() {
    int x, n;
    cin >> x >> n;
    set<int> s;
    forn(i, n){
        int y;
        cin >> y;
        s.insert(y);
    }
    int d = 0;
    while(true){
        if (!s.count(x - d)){
            cout << x - d << '\n';
            return;
        }
        if (!s.count(x + d)){
            cout << x + d << '\n';
            return;
        }
        d++;
    }
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

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

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var main = new Program();
            main.solve();
        }

        void solve()
        {
            var s = Console.ReadLine();
            for(int i = 0;i < s.Length; i++)
            {
                if(s[i] == '7')
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }
    }

    struct Vector2
    {
        public Vector2(long x, long y)
        {
            this.x = x;
            this.y = y;
        }
        public long x;
        public long y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 17348
s=input()+"<"; n=len(s)
# print(s,n)
bef=-1 ;ans=0 ;i=0
while i<n:
    
    if s[i]=="<":
        ans+=bef+1
        bef+=1
        i+=1
    else:
        cnt=0
        for j in range(i,n):
            if s[j]==">":
                ans+=cnt
                cnt+=1
            else:
                ans+=cnt
                break
        ans+= max(0, bef+1-cnt)
        bef=0
        i+= cnt +1
print(ans)

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

int main() {
    while (1) {
        int m, f, r;
        cin >> m >> f >> r;

        if (m == -1 && f == -1 && r == -1) {
            break;
        }

        if (m == -1 || f == -1) {
            cout << "F" << endl;
            continue;
        }

        int total = m + f;
        if (total >= 80) {
            cout << "A" << endl;
        } else if (total >= 65 && total < 80) {
            cout << "B" << endl;
        } else  if (total >= 50 && total < 65) {
            cout << "C" << endl;
        } else if (total >= 30 && total < 50) {
            if (r >= 50) {
                cout << "C" << endl;
            } else {
                cout << "D" << endl;
            }
        } else {
            cout << "F" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,sum,rem;
    double f;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
       sum=a/b;
       rem=a%b;
       f=(double)a/(double)b;
       cout<<sum<<" "<<rem<<" ";
       printf("%lf\n",f);
    }
}



Measured memory_bytes: 3252
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 100000000;

int p, q, a, n;
int solve(int psum, int qsum, int pmax, int qpro,  int ncnt){
	if (ncnt == n) return 0;
	int cnt = 0;
	for(int i = pmax; i*qpro <= a ; i++){
		int lhs = q*(psum*i+qsum);
		int rhs = qsum*i*p;
		if(lhs > rhs) continue;
		if(lhs == rhs) cnt++;
		if(lhs < rhs){
			cnt += solve(lhs/q, rhs/p, i, qpro*i, ncnt+1);
		}
	}
	return cnt;
}

int main(){
//	freopen("test.txt", "r", stdin);
	while(cin >> p >> q >> a >> n, p+q+a+n){
		cout << solve(0, 1, 1, 1, 0) << endl;
	}

	return 0;
}

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

using namespace std;
int main(void){
    int n=0, m=0, x=0, y=0;
    cin >> n >> m >> x >> y;
    vector<int>X(n,0);
    vector<int>Y(m,0);
    rep(i, n) cin >> X[i];
    rep(i, m) cin >> Y[i];
    X.push_back(x);
    Y.push_back(y);
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    //cout << X.back() << Y[0] << endl;
    
    if(Y[0] - X.back() >=1){
        cout << "No War";
    }else{
        cout << "War";
    }
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
ans = 0
b = [int(x) for x in input().split()]
for i in range(N):
    tmp = []
    a = [int(x) for x in input().split()]
    for j in range(M):
      tmp.append(a[j] * b[j])
    if sum(tmp) + C > 0:
      ans += 1

print(ans)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
  int n;
  bool f = false;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    if (c == 'Y') {
      f = true;
      break;
    }
  }
  if (f) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
  return 0;
}


Measured memory_bytes: 3132
N = int(input())

numbers = [[0 for i in range(10)] for i in range(10)]
for i in range(1, 10):
    for j in range(10):
        if i > N:
            continue
        tmp = 0
        if i == j:
            tmp += 1
        if i * 10 + j <= N:
            tmp += 1
        i_now = 100
        nine = 90
        nine_now = 10
        while i*i_now + nine + j <= N:
            tmp += nine_now
            i_now *= 10
            nine_now *= 10
            nine += 9 * nine_now

        if i*i_now <= N // i_now * i_now:
            if j <= N%10:
                tmp += (N%i_now)//10 + 1
            else:
                tmp += max(0, (N%i_now)//10)
        numbers[i][j] = tmp
ans = 0
for i in range(10):
    for j in range(10):
        ans += numbers[i][j]*numbers[j][i]
print(ans)



Measured memory_bytes: 38256
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

aa = [0,1,3,1,2,1,2,1,1,2,1,2,1]

x,y = map(int,input().split())

if aa[x] == aa[y]:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 3824
#include <stdio.h>

int main(void) {  int n ,ai ,i ,max ,min;          

long int sum = 0;    

scanf("%d" ,&n);    

for(i=0;i<n;i++){      

scanf("%d" ,&ai);      

sum += ai;      

if(i==0){        

max = ai;                        

min = ai;

}      

else if(ai>max){        

max = ai;      

}      

else if(ai<min){        

min = ai;       

}

          }     

printf("%d %d %ld\n" ,min ,max ,sum);      

return 0;     

}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N = in(),L = in();
    vector<string> S(N);
    REP(i,N)S[i] = in<string>();
    sort(ALL(S));
    REP(i,N)cout << S[i];
    cout << "\n";
}

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

using namespace std;

int main(){
	
  int n;
  cin >> n;
  
  set<int> s;
  int t;
  for(int i = 0; i<n; ++i){
  	cin >> t;
    if(s.find(t) != s.end()){
    	cout << "NO";
      return 0;
    }
    s.insert(t);
  }

  cout << "YES";
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
 
#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound
#define treap_pair pair<treap*, treap*>
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 2e5 + 2;
const int M = 1e5 + 2;
const int mod = 998244353;
const int inf = 1e9;
const ll INF = 1e16;

void data() {
	#ifdef PC
		freopen("b.in", "r", stdin);
		freopen("b.out", "w", stdout);
	#endif
}

ll x;

int main() {
	data();
	scanf("%lld", &x);
	printf("%lld", (x / 500LL) * 1000LL + ((x % 500LL) / 5LL) * 5LL);
}

/*
	Timus: 288481RF
	CodeForces: fractal
*/

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

int map[2][100001];

int main() {
    map[0][0] = 1;
    int N;
    cin >> N;
    int time = 0;
    while (1) {
        time ++;
        for (int i=1; i<=N; i++) {
            if (i-1 >= 0 && map[(time+1)%2][i-1] != 0) {
                map[time%2][i] = 1;
            }
            for (int x=6; i-x>=0; x*=6) {
                if (map[(time+1)%2][i-x] != 0) {
                    map[time%2][i] = 1;
                }
            }
            for (int x=9; i-x>=0; x*=9) {
                if (map[(time+1)%2][i-x] != 0) {
                    map[time%2][i] = 1;
                }
            }
            if (map[time%2][N] != 0) {
                cout << time << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 1024
// AOJ 2163 Tatami
// 2019.3.10 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int h, w, ans;
int map[22][22];
int tbl[200], id;

int ok(int r, int c)
{
	if (r == 0 || c == 0) return 1;
	tbl[map[r][c]] = ++id;
	if (tbl[map[r][c - 1]] == id) return 1;
	tbl[map[r][c - 1]] = id;
	if (tbl[map[r - 1][c]] == id) return 1;
	tbl[map[r - 1][c]] = id;
	return tbl[map[r - 1][c - 1]] == id;
}

void check(int k, int r, int c)
{
	if (c == w) {
		if (r == h - 1) ans++;
		else check(k, r + 1, 0);
		return;
	}
	if (map[r][c]) check(k, r, c + 1);
	else {
		if (r + 1 < h && !map[r + 1][c]) {
			map[r][c] = map[r + 1][c] = k;
			if (ok(r, c)) check(k + 1, r, c + 1);
			map[r][c] = map[r + 1][c] = 0;
		}
		if (c + 1 < w && !map[r][c + 1]) {
			map[r][c] = map[r][c + 1] = k;
			if (ok(r, c)) check(k + 1, r, c + 2);
			map[r][c] = map[r][c + 1] = 0;
		}
	}
}

int main()
{
	while (scanf("%d%d", &h, &w) && (h | w)) {
		if (h == w) putchar(h & 1 ? '0' : '2');
		else {
			ans = id = 0;
			memset(map, 0, sizeof(map));
			memset(tbl, 0, sizeof(tbl));
			check(1, 0, 0);
			printf("%d", ans);
		}
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 2048
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

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

	int N, Q;
	string S;
	cin >> N >> Q >> S;

	vector<int> ac( N );
	for( int i = 1; i < N; ++i ) {
		ac[i] = ac[i-1];

		if( S[i-1] == 'A' && S[i] == 'C' ) {
			ac[i] += 1;
		}
	}

	for( int i = 0; i < Q; ++i ) {
		int l, r;
		cin >> l >> r;

		cout << ac[r-1] - ac[l-1] << '\n';
	}

	return 0;
}


Measured memory_bytes: 1488
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		int max = 0;
		int max_let = 0;
		int ans = 1;
		for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 35776
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <tuple>
#include <utility>
#include <functional>
#include <sys/time.h>
#include <iomanip>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(i, m, n) for(int i = (m); i < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
void setp(const int n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

constexpr int BEAM_SIZE = 400;
constexpr int SZ = 26;
constexpr int D = 365;
array<int, SZ> C;
array<array<int, SZ>, D> S;

struct State {
	array<int, SZ> last = {};
	array<int, D> ans;
	int score = 0;

	void update_score(int d, int t) {
		score += S[d][t];
		rep(i, SZ) score -= C[i] * (d + 1 - last[i]);
	}

	int eval() const {
		return score;
	}

	State place(int d, int t) {
		State res = *this;
		res.ans[d] = t;
		res.last[t] = d + 1;
		res.update_score(d, t);
		return res;
	}

	array<int, D> answer() {
		return ans;
	}
};

array<int, D> solve() {
	State initial_state;
	using f = function<bool(State&, State&)>;
	priority_queue<State, vector<State>, f> cur([](State& a, State& b){return a.eval() > b.eval();});
	cur.push(initial_state);
	priority_queue<State, vector<State>, f> nxt([](State& a, State& b){return a.eval() > b.eval();});
	rep(d, D){
		while(!nxt.empty()) nxt.pop();
		while(!cur.empty()){
			State now = cur.top(); cur.pop();
			rep(t, SZ){
				if(nxt.size() < BEAM_SIZE || now.place(d, t).eval() > nxt.top().eval()) nxt.push(now.place(d, t));
				if(nxt.size() > BEAM_SIZE) nxt.pop();
			}
		}
		swap(cur, nxt);
	}

	State res;
	while(!cur.empty()){
		if(cur.size() == 1) res = cur.top();
		cur.pop();
	}
	cerr << res.eval() << endl;
	return res.answer();
}

int main(void){
	int tmp;
	cin >> tmp;
	rep(i, SZ) cin >> C[i];
	rep(i, D) rep(j, SZ) cin >> S[i][j];

	auto ans = solve();
	for (int i : ans) cout << i + 1 << endl;

	return 0;
}


Measured memory_bytes: 5108