akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
    int a,b,c;
	scanf("%d %d %d", &a,&b,&c);
	if(a<b && b<c) {
	    printf("Yes\n");
	}
	else {
	    printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2656
H, W = map(int, raw_input().split())
grid = [raw_input() for r in range(H)]
for r in range(H):
    line = ""
    for c in range(W):
        if grid[r][c] == "#":
            line += "#"
        else:
            cnt = 0
            for dr in range(-1, 2):
                for dc in range(-1, 2):
                    nr, nc = r+dr, c+dc
                    if (0 <= nr < H) and (0 <= nc < W) and (grid[nr][nc] == "#"):
                        cnt += 1
            line += str(cnt)
    print line

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

vector<vector<int> > dp;

int main() {
    ll n, m;
    while(cin >> n >> m, n){
        vector<ll> a(n, 0);
        vector<string> b(n);
        REP(i,n){
            cin >> b[i];
        }
        if(n <= 20){
            ll ans = 0;
            REP(S,(1<<n)){
                string sum;
                REP(j,m) sum.push_back('0');
                ll cnt = 0;
                REP(i,n){
                    if((S>>i)&1){
                        REP(j,m){
                            if(b[i][j] == '1'){
                                sum[j] = sum[j]=='0'?'1':'0';
                            }
                        }
                        cnt++;
                    }
                }
                bool ok = true;
                REP(j,m){
                    ok &= sum[j]=='0';
                }
                if(ok){
                    ans = max(ans, cnt);
                }
            }
            cout << ans << endl;
        }
        else{
            REP(i,n){
                REP(j,m){
                    if(b[i][j]=='1') a[i] += 1LL<<j;
                }
            }
            dp.resize(2);
            REP(i,2) dp[i].assign(1<<m, -1);
            dp[0][0] = 0;
            REP(i,n){
                REP(j,(1<<m)){
                    if(dp[i%2][j]==-1) continue;
                    dp[(i+1)%2][j] = max(dp[(i+1)%2][j],dp[i%2][j]);
                    dp[(i+1)%2][j^a[i]] = max(dp[(i+1)%2][j^a[i]],dp[i%2][j]+1);
                }
            }
            cout << dp[n%2][0] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 84916
s=input()

sl=len(s)+1
l=[0]*sl

for i in range(sl-1):
  if s[i]=="<":
    l[i+1]=l[i]+1
    
for i in range(sl-2,-1,-1):
  if s[i]==">":
    l[i]=max(l[i+1]+1, l[i])
    
print(sum(l))
  
  

Measured memory_bytes: 29192
// B - Algae

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

int main() {
	int r, D, x;
	cin >> r >> D >> x;

	for (int i=1; i<=10; i++) {
		x = r * x - D;
		cout << x << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<pair<int,int>> v;
  for(int j=0;j<n;j++)
  {
    int a,b;
    cin>>a>>b;
    v.push_back(make_pair(a,b));
  }
  v.push_back(make_pair(1,-1));
  int c=0,flag=0;
  for(int j=0;j<n+1;j++)
  {
    if(v[j].first==v[j].second)
    {
      c++;
    }
    else
    {
      if(c>=3)
      {
        flag=1;
        break;
      }
      c=0;
      //flag=0;
    }
  }
  
  if(flag==1)
    cout<<"Yes"<<"\n";
  else
    cout<<"No"<<"\n";
  return 0;
}


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

int main() {
  
  vector<int> n(3);
  cin >> n.at(0) >> n.at(1) >> n.at(2);
  
  sort(n.begin(),n.end());
  
  for (int i = 0; i < 3; i++)
    n.at(2 - i) -= n.at(0); 
  
  int count = 0;
  
  while ((!(n.at(0) == n.at(1)) || !(n.at(1) == n.at(2))) || !(n.at(0) == n.at(2))) {
    if (n.at(1) == n.at(2))
      n.at(0) += 2; 
    else {
      n.at(0)++;
      n.at(1)++;
    }
    sort(n.begin(),n.end());
    count++;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#include<queue>
#define MM 1000000007
using namespace std;
int main(void)
{
	long long dp[2001],x;
	int s,i,j;
	scanf("%d",&s);
	for(i=1;i<=s;i++)	dp[i]=0;
	dp[0]=1;
	for(i=0;i<s;i++)	{
		for(j=3;j+i<=s;j++)	{
			dp[i+j]+=dp[i];
			dp[i+j]=dp[i+j]%MM;
		}
	}
	printf("%lld\n",dp[s]);
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  vector<int> cnum(26);
  for (int i=0; i<s.size(); i++)
    cnum.at(s.at(i) - 'a')++;
  bool is_b=true;
  for (int i=0; i<26; i++)
    if (cnum.at(i) % 2 == 1)
      is_b = false;
  if (is_b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
    string s;
    cin >> s;
    int final_ans = 0;
    for(int i=0;i<s.size();i++){
        int ans = 0;
        for(int j=i;j>=0;j--){
            if (s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T'){
                ans++;
            }else{
                break;
            }
        }
        final_ans = max(final_ans, ans);
    }
    cout << final_ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 int main()
 {
 	char a[100][100];
 	int i,j,h,l;
 	while(scanf("%d%d",&h,&l)!=EOF)
 	{
 		for(i=0;i<h;i++)
 		{
 			getchar();
 			for(j=0;j<l;j++)
 			{
 				scanf("%c",&a[i][j]);
			 }
		 }
		 for(i=0;i<l+2;i++)
		 {
		 	printf("%c",'#');
		 }
		 printf("\n");
		 for(i=0;i<h;i++)
		 {
		 printf("%c",'#');
		 for(j=0;j<l;j++)
		 {
		 	printf("%c",a[i][j]);
			 }	
			 printf("%c\n",'#');
		 }
		 for(i=0;i<l+2;i++)
		 {
		 	printf("%c",'#');
		 }
	 }
 }

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main() {
    
    string s;
    cin>>s;
    if(s[0]=='R'&&s[1]=='R'&&s[2]=='R')cout<<3<<endl;
    else if(s[0]=='R'&&s[1]=='R')cout<<2<<endl;
    else if(s[0]=='R')cout<<1<<endl;
    else if(s[1]=='R'&&s[2]=='R')cout<<2<<endl;
    else if(s[1]=='R')cout<<1<<endl;
    else if(s[2]=='R')cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}

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

typedef struct Tree{
  int key;
  struct Tree *parent;
  struct Tree *left;
  struct Tree *right;
}Tree;

Tree *t;
void Print1(Tree*);
void Print2(Tree*);
void Insert(int);  

int main(){
  int m,i,key;
  char comma[7];
  scanf("%d",&m);
  t=(Tree*)malloc(sizeof(Tree)*1);
  t->parent=t->left=t->right=NULL;
  t->key=2000000001;
  for(i=0;i<m;i++){
    scanf("%s",&comma);
    if(strcmp(comma,"insert")==0){
      scanf("%d",&key);
      Insert(key);
     }
    else if(strcmp(comma,"print")==0){
      Print1(t);
      printf("\n");
      Print2(t);
      printf("\n");
    }
  }
  free(t);
  return 0;
}

void Insert(int key){
  Tree *y;
  Tree *x;
  Tree *hoge;
  if(t->key==2000000001){
    t->key=key;
    return;
  }
  x=t;
  y=NULL;
  hoge=(Tree*)malloc(sizeof(Tree)*1);
  hoge->key=key;
  hoge->parent=hoge->left=hoge->right=NULL;
  while(x!=NULL){
    y=x;
    if(key<x->key)
      x=x->left;
    else
      x=x->right;
    hoge->parent=y;
  }
  if(hoge->key<y->key)
    y->left=hoge;
  else
    y->right=hoge;
}

void Print1(Tree *x){
  if(x==NULL)
    return;
  else{
    Print1(x->left);
    printf(" %d",x->key);
    Print1(x->right);
  }
}

void Print2(Tree *x){
  if(x==NULL)
    return;
  else{
    printf(" %d",x->key);
    Print2(x->left);
    Print2(x->right);
  }
}

Measured memory_bytes: 24040
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	vector<bool> is_appeared(26, false);
	for (int i = 0; i < s.size(); i++)
	{
		is_appeared[s[i] - 'a'] = true;
	}

	char res = 'a';
	for (int i = 0; i < 26; i++)
	{
		if (!is_appeared[i]) {
			cout << res << endl;
			return 0;
		}
		res++;
	}
	cout << "None" << endl;
	return 0;
}


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

int main(){
    //std::vector<int> vec{ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5,4, 1, 4, 1, 51};
    int arr[]={  1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5,4, 1, 4, 1, 51};
    int N;
    cin >> N;
    cout << arr[N-1] << endl;
}

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

int main(){
    int n,r;
    cin >> n >> r;
    if(n<10)cout << r + 100*(10-n);
    else cout << r << endl;
}

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

using namespace std;

int main()
{
        int n = 0;

        cin >> n;

        vector<int> l;

        for (int i = 0; i < n * 2; i++) {
                int buf;
                cin >> buf;
                l.push_back(buf);
        }

        sort(begin(l), end(l), greater<int>());

        int sam = 0;

        for (int i = 0; i < n * 2; i += 2) {
                sam += l[i + 1];
        }

        cout << sam << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};

int f(int a,int b){
    int res = 0;
    if(a >= b){
        while(a){
            a/=10;
            res++;
        }
    }else{
        while(b){
            while(b){
                b/=10;
                res++;
            }
        }
    }
    return res;
}


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


    ll n;
    cin >> n;
    ll a,b;
    pair<int,int> ans;
    int mi = INF;
    int t = sqrt(n);
    for(int i = t;i >= 1;--i){
        if(n % i == 0){
            a = i;
            b = n/i;
            int x = f(a,b);
            mi = x;
            ans = make_pair(a,b);
            break;
        }
    }
    cout << mi << endl;
    cout << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

vector<vector<int>> G;

int dfs(int v = 0, int p = -1) {
    int res = 0;
    for (int u : G[v]) {
        if (u == p) continue;
        res ^= (dfs(u, v) + 1);
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    G = vector<vector<int>>(n);
    REP(i, n - 1) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    cout << (dfs() ? "Alice\n" : "Bob\n");
    return 0;
}


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

int main(){
  	int x,y,a;
	int w,h,n;
  	cin>>w>>h>>n;
  	int xmax=0,xmin=w,ymax=0,ymin=h;
  	for(int i=1;i<=n;++i){
    	cin>>x>>y>>a;
      	if(a==1)xmax=max(xmax,x);
      	else if(a==2)xmin=min(xmin,x);
      	else if(a==3)ymax=max(ymax,y);
      	else ymin=min(ymin,y);
    }
  	int ans=(xmin-xmax)*(ymin-ymax);
  	if(ans<0||(xmin-xmax)+(ymin-ymax)<0)ans=0;
  	cout<<ans<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define sp fixed<<setprecision
#define sz sizeof
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
bool pr[1000007];
ll fpow(ll x,ll y){x=x%MOD;ll res=1;while(y){if(y&1)res=res*x;res%=MOD;y=y>>1;x=x*x;x%=MOD;}return res;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
bool visited[100005];
ll dp[100005][2];
vector<ll>adj[100005];
void dfs(ll x)
{
	visited[x]=true;
	ll cnt=0,wt=1,bl=1;
	for(auto a:adj[x])
	{
		if(!visited[a])
		{
			dfs(a);
			cnt++;
			wt*=(dp[a][0]+dp[a][1]);
			wt%=MOD;
			bl*=(dp[a][0]);
			bl%=MOD;
		}
	}
	if(!cnt)
	{
		dp[x][0]=1;
		dp[x][1]=1;
	}
	else
	{
		dp[x][0]=wt;
		dp[x][1]=bl;
	}

}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n;
	cin>>n;
	for(int i=0;i<n-1;i++)
	{
		ll x,y;
		cin>>x>>y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	dfs(1);
	cout<<(dp[1][0]+dp[1][1])%MOD;

}


Measured memory_bytes: 14464
/*	AtCoder 2171 Shik and Game
    1st Edition:2017.11.25 Saturday
    Algorithm:DP,╣╔╣В╤сап
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <cctype>
using namespace std;

#define For(a,b,c) for(int (a)=(b);(a)<=(c);++a)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define shl(x,y) ((x)<<(y))
#define shr(x,y) ((x)>>(y))
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;
const ll inf=2000000007LL;
const double EPS=1e-10;
const ll inf_ll=(ll)1e18;
const ll maxn=100005LL;
const ll mod=1000000007LL;

//input
int n;
ll T,E;
ll x[maxn];

void input(){
	scanf("%d%lld%lld",&n,&E,&T);
	For(i,1,n) scanf("%lld",x+i);
}

//DP
ll f[maxn];

void dp_init(){
	f[0]=0;
	For(i,1,n) f[i]=inf_ll;
}

void dp_test(){
	puts("\ndp tests begin");
	For(i,1,n) printf("%d ",f[i]);
	puts("");
	puts("dp tests end\n");
}

void dp_main(){
	dp_init();
	int divl=0;
	ll min2=inf_ll;
	if(x[1]*2>T) min2=0;
	For(i,1,n){
		min2+=2*(x[i]-x[i-1]);
		while(divl<i && 2*(x[i]-x[divl+1])>T){
			min2=min(min2,f[divl]+(x[i]-x[divl+1])*2);
			++divl;
		}
//		printf("%d %lld %lld\n",divl,f[divl]+T,min2);
		f[i]=min(min2,f[divl]+T);
	}
	printf("%lld\n",E+f[n]);
//	dp_test();
}

//main
int main(){
	input();
	dp_main();
	return 0;
}

/*
3 9 1
1 3 8

3 9 3
1 3 8

2 1000000000 1000000000
1 999999999

*/


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int h[111];

int main()
{
    int n;
    cin>>n;
    int ans = 0;
    int maxh = 0;
    REP(i,n) {
        cin>>h[i];
        if (h[i] >= maxh) {
            ans++;
            maxh = h[i];
        }
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s, t;
int cnt;
int main() {
	cin >> s >> t;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] != t[i])	cnt++;
	}
	cout << cnt << "\n";
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> divisors(10000007, 1);
  for (int i = 2; i <= 10000000; i++) {
    int tmp = i;
    while (tmp <= 10000000) {
      divisors.at(tmp - 1) = divisors.at(tmp - 1) + 1;
      tmp += i;
    }
  }
  ll ans = 0;
  rep(i,n) {
    ans += ll((i + 1)) * ll(divisors.at(i));
  }
  cout << ans << endl;
}

Measured memory_bytes: 42328
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define eps 1e-9
#define oo 1e7+5

using namespace std;

typedef unsigned long long ull;
typedef vector<pair<int,pair<int,int>>> dirgraph;
typedef vector<vector<int>> graph;

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	
	char A='A';
	char a='a';
	char k;
	cin>>k;
	if((int)k>=97 && (int)k<=122)
		cout<<a<<endl;
	else cout<<A<<endl;

	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
const int N = 3000 + 10;
int n;
struct Node {
    int pos, val;
}a[N];
long long dp[N][N];
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        int x;  scanf("%d", &x);
        a[i] = (Node){i, x};
    }
    sort(a + 1, a + 1 + n, [&](Node a, Node b){return a.val > b.val; });
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < i; j++) {
            dp[j + 1][i - j - 1] = max(dp[j + 1][i - j - 1], dp[j][i - j - 1] + 1LL * abs(a[i].pos - (j + 1)) * a[i].val);
            dp[j][i - j] = max(dp[j][i - j], dp[j][i - j - 1] + 1LL * abs(a[i].pos - (n - (i - j) + 1)) * a[i].val);
        }
    }
    long long ans = 0;
    for (int i = 0; i <= n; i++) {
        ans = max(ans, dp[i][n - i]);
    }
    printf("%lld\n", ans);
#ifndef ONLINE_JUDGE
    system("pause");
#endif
    return 0;
}

Measured memory_bytes: 27480
#include <bits/stdc++.h>
    using namespace std;
    const long long INF = 1LL <<60;
    const long long Mo=1000000007;
         
    long long gcn(long long x,long long y){
      if(x%y==0){
        return y;  
      }
      else{
        return gcn(y,x%y);
      }
    }
     
    long long modpow(long long a, long long n, long long mod) {
        long long res = 1;
        while (n > 0) {
            if (n & 1) res = res * a % mod;
            a = a * a % mod;
            n >>= 1;
        }
        return res;
    }
     
    int main(void){
      double tmp;
      long long n,k;
      long long x=0;
      long long i,j;
      long double res=0.0;
      string str;
     
      cin>>str;
      n=str.length();
      cout<<str;
      if(str[n-1]=='s'){
        cout<<"es"<<endl;
      }
      else{
        cout<<"s"<<endl;
      }

      
      //cout<<setprecision(15)<<res<<endl;
      //cout<<res<<endl;
      
      return 0;
    }

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;



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

    int N;
    cin >> N;
    int ans=1;
    int A[N];
    int w=0;
    rep(i,N){
        cin >> A[i];
        if(w==0){
            w=1;
        }else if(w==1){
            if(A[i-1]>A[i]){
                w=2;
            }else if(A[i-1]-A[i]){
                w=3;
            }
        }else if(w==2){
            if(A[i-1]<A[i]){
                ans++;
                w=1;
            }
        }else if(w==3){
            if(A[i-1]>A[i]){
                ans++;
                w=1;
            }
        }

    }
    cout << ans << endl;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll mypow(ll a, ll b) {
    ll ret = 1;
    while (b--) {
        ret *= a;
    }
    return ret;
}

ll keta(ll a) {
    ll ret = 0;
    while (a) {
        ret++;
        a /= 10;
    }
    return ret;
}

ll sumd(ll a) {
    ll ret = 0;
    while (a) {
        ret += a % 10;
        a /= 10;
    }
    return ret;
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = 0;
    rep(i, n + 1) {
        if (a <= sumd(i) && sumd(i) <= b) {
            ans += i;
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#define MAX 100000

int parent (int);
int left(int);
int right(int);
int main(void){
    int H,i,A[MAX+1];
    scanf("%d",&H);
    for(i=1;i<=H;i++)
        scanf("%d",&A[i]);
    for(i=1;i<=H;i++){
        printf("node %d: key = %d, ",i,A[i]);
        if(parent(i) >= 1)
            printf("parent key = %d, ",A[parent(i)]);
        if(left(i) <= H)
            printf("left key = %d, ",A[left(i)]);
        if(right(i) <= H)
            printf("right key = %d, ",A[right(i)]);
        puts("");
    }
    return 0;
}
int parent (int i){
    return i/2;
}
int left(int i){
    return 2*i;
}
int right(int i){
    return 2*i+1;
}



Measured memory_bytes: 2100
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

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

int main()
{
    int x,y;
    cin >> x >> y;
    cout << x+y/2 << endl;




    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

using P = pair<int, int>;

void dfs(const vector<vector<int>>& graph, vector<int>& color, vector<bool>& visited, int node, int c) {
    visited[node] = true;
    color[node] = c;
    rep(i, 0, graph[node].size()) {
        if (visited[graph[node][i]]) {
            continue;
        }
        dfs(graph, color, visited, graph[node][i], c);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, K;
    cin >> N >> M >> K;
    vector<int> A(M), B(M), C(K), D(K);
    rep(i, 0, M) {
        cin >> A[i] >> B[i];
        --A[i], --B[i];
    }
    rep(i, 0, K) {
        cin >> C[i] >> D[i];
        --C[i], --D[i];
    }
    vector<vector<int>> graph(N);
    map<P, bool> exists;
    rep(i, 0, M) {
        graph[A[i]].push_back(B[i]);
        graph[B[i]].push_back(A[i]);
        exists[P(A[i], B[i])] = exists[P(B[i], A[i])] = true;
    }
    vector<bool> visited(N, false);
    vector<int> color(N, -1);
    int now_color = 0;
    rep(i, 0, N) {
        if (!visited[i]) {
            dfs(graph, color, visited, i, now_color);
            ++now_color;
        }
    }
    rep(i, 0, K) {
        if (!exists[P(C[i], D[i])] && !exists[P(D[i], C[i])] && color[C[i]] == color[D[i]]) {
            graph[C[i]].push_back(D[i]);
            graph[D[i]].push_back(C[i]);
        }
    }
    vector<int> color_cnt(now_color, 0);
    rep(i, 0, N) {
        ++color_cnt[color[i]];
    }
    rep(i, 0, N) {
        set<int> edges;
        rep(j, 0, graph[i].size()) {
            edges.insert(graph[i][j]);
        }
        cout << color_cnt[color[i]] - (int)edges.size() - 1 << " \n"[i + 1 == N];
    }
    return 0;
}

Measured memory_bytes: 39032
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		long a = scan.nextLong();
		long b = scan.nextLong();

		long sum = (n / (a + b)) * a + Math.min(a, (n % (a + b)));
		System.out.println(sum);
		scan.close();
	}
}

Measured memory_bytes: 23508
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll poc(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll a,b,c,k;cin>>a>>b>>c>>k;
    if(k<=a+b)cout<<min(k,a)<<endl;
    else cout<<a-(k-a-b)<<endl;
}


Measured memory_bytes: 3604
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n, m, p;
    cin >> n >> m >> p;

    vector<int> d(m);
    for(int i=0; i<m; ++i){
        cin >> d[i];
        d[i] = (d[i] + n - p) % n;
    }
    sort(d.begin(), d.end());

    int ans = min(n - d[0], d[m-1]);
    for(int i=0; i<m-1; ++i)
        ans = min(ans, 2 * d[i] + (n - d[i+1]));
    for(int i=1; i<m; ++i)
        ans = min(ans, 2 * (n - d[i]) + d[i-1]);

    ans *= 100;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 			1000000007
#define tc(t) 			int t;cin >> t;while(t--)
#define for0(i , n)		for(int i=0;i<n;i++)
#define loop(i , a, b)	for(int i=a;i<=b;i++)
#define endl 			'\n'
#define inf 			1e18
#define fi 				first
#define se 				second

int XX[8] = { +1, +1, +1, 0, 0, -1, -1, -1};
int YY[8] = { +1, 0, -1, +1, -1, +1, 0, -1};
int dx[4] = { -1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int n, k;
vector<int> a;
bool dp[100005];

string solve() {
	dp[0] = 0;
	for (int i = 1; i <= k; i++) {
		for (int move : a) {
			if (move > i)continue;
			if (dp[i - move] == 0) {
				dp[i] = 1;
			}
		}
	}

	return dp[k] ? "First" : "Second";
}

signed main() {

	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

	cin >> n >> k;

	a.assign(n, 0);
	for0(i, n) cin >> a[i];

	memset(dp, 0, sizeof(dp));

	cout << solve() << endl;

	return 0;
}

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

using namespace std;

const int maxn = 1e5 + 100;
int  s[500];
int t[50];

bool cmp(int a,int b) {
    return a<b;
}

int main() {
    int n,sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i];
        sum+=s[i];
    }
    sort(s,s+n,cmp);
    if(sum%10!=0){
        cout<<sum<<endl;
        return 0;
    }
    for(int i=0;i<n;i++){
        if((sum-s[i])%10!=0){
            cout<<sum-s[i]<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 256
n,l = list(map(int, input().split()))

ls = []
for i in range(1,n+1):
  ls.append(l+i-1)
total = sum(ls)

flag=0
ans = abs(total-(total-ls[0]))
for i in range(n):
  tst = total - ls[i]
  dif = abs(total-tst)
  if dif<ans:
    flag = i
    ans = dif
print(total-ls[flag])

Measured memory_bytes: 3064
#include <cstdio>

#define MAX (8)

int main(void)
{
    char map[4][MAX][MAX + 1];
    
    for (int i = 0; i < MAX; i++){
        scanf("%s", map[0][i]);
    }
    
    for (int x = 1; x < 4; x++){
        for (int i = 0; i < MAX; i++){
            for (int j = 0; j < MAX; j++){
                map[x][j][MAX - i - 1] = map[x - 1][i][j];
            }
        }
    }
    
    for (int x = 1; x < 4; x++){
        printf("%d\n", x * 90);
        for (int i = 0; i < MAX; i++){
            map[x][i][MAX] = '\0';
            printf("%s\n", map[x][i]);
        }
    }
    
    return (0);
}

Measured memory_bytes: 0
mx,my;pn[7];px[7][1000],py[7][1000];M[5][7][1000];a0;Calc(a1,a2){int n1,n2,m,mm;for(n2=0;n2<pn[a2];n2++){mm=1e9;for(n1=0;n1<pn[a1];n1++){m=M[a0][a1][n1]+abs(px[a1][n1]-px[a2][n2])+abs(py[a1][n1]-py[a2][n2]);if(m<mm)mm=m;}M[a0][a2][n2]=mm;}}main(){int x,y,c,a,am;for(;scanf("%d%d\n",&mx,&my),mx;){memset(pn,0,sizeof(pn));for(y=0;y<my;y++){for(x=0;x<=mx;x++){c=getchar();if(c>='1'){if(c<='5')a=c-'0';else if(c=='S')a=0;else if(c=='G')a=6;px[a][pn[a]]=x;py[a][pn[a]++]=y;}}}am=0;for(a0=0;a0<5;a0++){M[a0][0][0]=0;Calc(0,1+(a0+1)%5);for(a=0;a<3;a++)Calc(1+(a0+a+1)%5,1+(a0+a+2)%5);Calc(1+(a0+4)%5,6);if(M[a0][6][0]<M[am][6][0])am=a0;}printf(M[am][6][0]!=1e9?"%d %d\n":"NA\n",1+am,M[am][6][0]);}{int n;for(n=1000000;n--;)getchar();}exit(0);}

Measured memory_bytes: 600
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,x;bool ans;
int num[100005];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m*2;i++) scanf("%d",&x),num[x]++;
	//for(int i=1;i<=n;i++) printf("%d ",num[i]);
	for(int i=1;i<=n;i++) if(num[i]%2==1) ans=1;
	printf(ans?"NO":"YES");
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    sort(l.begin(),l.end());
    int sum = 0;
    rep(i,n-1) sum += l[i];
    if (sum > l[n-1]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
  int A, B;
  cin >> A >> B;

  int cnt = 0;
  int sum = 1;
  while (sum < B) {
    sum += A - 1;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n; long long c[499], s[499], f[499];
  scanf("%d", &n);
  
  long long t;
  for(int i = 0; i < n - 1; i++){
    scanf("%lld %lld %lld", &c[i], &s[i], &f[i]);
  }

  for(int i = 0; i < n - 1; i++){
    t = 0;
    for(int j = i; j < n - 1; j++){
      if(t <= s[j]) t = s[j] + c[j];
      else{
	if(t % f[j] == 0) t += c[j];
	else t = t - t % f[j] + f[j] + c[j];
      }
    }
    printf("%lld\n", t);
  }

  printf("0\n");

  return 0;
}
    


Measured memory_bytes: 128
#include<cstdio>

int main(){
  int h,w;
  while(1){
    scanf("%d %d",&h,&w);
    if(h == 0 && w == 0) break;
    for(int i = 1; i <= h;i++){
      for(int u = 1; u <= w;u++){
	if(i == 1 || i == h){
	  printf("#");
	}else if(u == 1 || u == w){
	   printf("#");
	}else{
	  printf(".");
	}
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 1000
import sys

input = sys.stdin.readline

N, M = map(int, input().split())

Pm = [0] * M
Ym = [0] * M
ym = [0] * M

Am = [[0 for i in range(2)] for j in range(M)]
Cn = [0] * N

D = {}

for i in range(M):
    P, Y = map(int, input().split())

    Pm[i], Ym[i] = P, Y

    ym[i] = Y

    D[Y] = i

ym.sort()

for i in range(M):
    k = D[ym[i]]

    # 0-indexed
    Cn[Pm[k] - 1] += 1
    Am[k] = [Pm[k], Cn[Pm[k] - 1]]

for i in range(M):
    print('{:06d}{:06d}'.format(Am[i][0], Am[i][1]))


Measured memory_bytes: 38624
n=int(input())
a=list(map(int,input().split()))

for i in range(n):
    if a[i]%6==0 or a[i]%10==0 or a[i]%2==1:
        flag=True
    else:
        flag=False
        print('DENIED')
        break
if flag:
    print('APPROVED')


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

int main() {
    int n; cin >> n;
    string s; cin >> s;
    vector<vector<int>> a(n,vector<int>(3,0));
    if(s[0] == 'R') a[0][0]++;
    else if(s[0] == 'G') a[0][1]++;
    else a[0][2]++;
    for(int i = 1; i < n; i++){
        a[i][0] = a[i-1][0];
        a[i][1] = a[i-1][1];
        a[i][2] = a[i-1][2];
        char si = s[i];
        if(si == 'R') a[i][0]++;
        else if(si == 'G') a[i][1]++;
        else a[i][2]++;
    }

    int64_t ans = 0;
    for(int i = 1; i < n; i++){
        int si;
        if(s[i] == 'R') si = 0;
        else if(s[i] == 'G') si = 1;
        else si = 2;
        for(int j = i+1; j < n; j++){
            int sj;
            if (s[j] == 'R') sj = 0;
            else if (s[j] == 'G') sj = 1;
            else sj = 2;
            if(si == sj) continue;
            int clr = 3-si-sj;
            ans += a[i-1][clr];
            int ng = 2*i-j;
            if(ng >= 0){
                if(clr == 0 && s[ng] == 'R'){
                    ans--;
                }
                if (clr == 1 && s[ng] == 'G'){
                    ans--;
                }
                if (clr == 2 && s[ng] == 'B'){
                    ans--;
                }
            }
        }
    }
    
    cout << ans << endl;
}


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

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

class Mod{
  public:
    ll mod;
ll kaijou[200005];
ll inv[200005];
// mod must be a prime number
Mod(ll m){
    mod = m;
    kaijou[0] = 1;
    for (ll i = 1;i <= 200003;i++){
        kaijou[i] = kaijou[i-1]*i%mod;
        inv[i] = modpow(kaijou[i],mod-2);
    }
}
    //a^p
    ll modpow(ll a, ll p){
        if(p == 0) return 1;
        if(p%2 == 0){
            ll half = modpow(a, p/2);
            return half * half % mod;
        }
        else return a * modpow(a,p-1) % mod;
    }

    //nCr
    ll comb(ll n, ll r){
        if(r > n-r) return comb(n,n-r);
        ll mul = 1;
        ll div = 1;
        for (int i = 0;i < r;i++){
            mul *= n-i;
            mul %= mod;
            div *= i+1;
            div %= mod;
        }
        return mul * modpow(div,mod-2) % mod;
    }

    ll fcomb(ll n, ll r){
        if(r > n-r) return fcomb(n,n-r);
        if(r == 0) return 1;
        return (kaijou[n]*inv[n-r]%mod)*inv[r]%mod;
    }
};

long long lgcd(long long x,long long y){
	if(x==0) return y;
	return lgcd(y%x, x);
}

ll N;
ll A[200005],B[200005];

map<P,bool> used;

map<P,ll> mp;

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

    Mod m(1e9+7);

    cin >> N;
    ll cnt2 = 0;
    for (int i = 0;i < N;i++){
        cin >> A[i] >> B[i];
        if(A[i] == 0 && B[i] == 0){cnt2++; continue;}
        else if(A[i] == 0){
            mp[P(0,1)]++;
            continue;
        }else if(B[i] == 0){
            mp[P(1,0)]++;
            continue;
        }
        ll g = lgcd(abs(A[i]),abs(B[i]));
        A[i] /= g;
        B[i] /= g;
        if(A[i] < 0){
            A[i] *= -1;
            B[i] *= -1;
        }
        mp[P(A[i],B[i])]++;
        //cout << A[i] << " " << B[i] << " sadfasd" << endl;
    }

    ll cnt = 0;
    ll ans = 1;

    bool f = false;

    for (const auto& [key, value] : mp){
        //std::cout << key.first << " => " << value << "\n"
        //cout << "dfsdfs" << endl;
        if(used[key]) continue;
        ll va = value;
        ll a = key.second, b = -key.first;
        if(a < 0){ a *= -1; b *= -1;}
        used[P(a,b)] = true;
        used[key] = true;
        ll vb = mp[P(a,b)];
        //cout << va << " " << vb << " " << (m.modpow(2,va)+m.modpow(2,vb)+m.mod-1)%m.mod << " " << key.first << " " << key.second << endl;
        ans *= (m.modpow(2,va)+m.modpow(2,vb)+m.mod-1)%m.mod;
        cnt++;
        if(vb == 0) f = true;
        ans %= m.mod;
    }

    ans += cnt2;
    ans %= m.mod;
    cout << (ans+m.mod-1)%m.mod << endl;

    return 0;

}


Measured memory_bytes: 59872
s=int(input())
an = []
i = 0
while 1:
  i+=1
  if i == 1:
    an.append(s)
  else:
    if s % 2 == 0:
      s = s//2
    elif s % 2 == 1:
      s = 3*s+1
    an.append(s)
    if an.count(s) == 2:
      break
print(i)

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

int main(){
  int x;
  cin >> x;
  if (x>=1800)
    cout << "1" << endl;
  else if(x>=1600)
    cout << "2" << endl;
  else if (x>=1400)
    cout << "3" << endl;
  else if (x>=1200)
    cout << "4" << endl;
  else if (x>=1000)
    cout << "5" << endl;
  else if (x>=800)
    cout << "6" << endl;
  else if (x>=600)
    cout << "7" << endl;
  else if (x>=400)
    cout << "8" << endl;
  return 0;
}


Measured memory_bytes: 3632
package main

import (
	"fmt"
	"sort"
)

func main(){
	var X, Y, Z, K int
	fmt.Scan(&X,&Y,&Z,&K)
	a := make([]int,X)
	b := make([]int,Y)
	c := make([]int,Z)

	for i := 0; i < X; i++ {
		fmt.Scan(&a[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))

	for i := 0; i < Y; i++ {
		fmt.Scan(&b[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(b)))

	for i := 0; i < Z; i++ {
		fmt.Scan(&c[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(c)))

	var H []int
	for i := 0; i < X; i++ {
		for j := 0; j < Y; j++ {
			for k := 0; k < Z; k++ {
				if (i+1)*(j+1)*(k+1) <= K {
					H = append(H,a[i]+b[j]+c[k])
				} else {
					break
				}
			}
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(H)))
	for i := 0; i < K; i++ {
		fmt.Println(H[i])
	}
}


Measured memory_bytes: 5504
import java.util.*;
//import static java.lang.Integer.*;
import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		long m = parseLong(sc.next());
		sc.close();
		out.println(48-m);
	}
}


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

int main() {

  int a,b,c;
  bool d=0;
  cin>>a>>b>>c;
  
  if(a==b&&a!=c)d=1;
  if(a!=b&&a==c)d=1;
  if(b==c&&b!=a)d=1;
  
  if(d==1){
  	cout<<"Yes"<<endl;
  }else{
  	cout<<"No"<<endl;
  }

  
}


Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 25.07.2020 21:08:29
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define SORT(x) sort(x.begin(),x.end())
#define SORTD(x) sort(x.rbegin(),x.rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SZ(x) ll(x.size())

#define MEMSET(v, h) memset((v), h, sizeof(v))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

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

  ll n,k;
  cin>>n>>k;

  ll a[n];
  REP(i,n)cin>>a[i];

  REP(i,n-k)
  {
    if(a[i]<a[i+k])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }

  return 0;
}

Measured memory_bytes: 5212
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
    for j in range(B+1):
        for n in range(C+1):
            if i*500+j*100+n*50 == X:
                count = count+1
print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
struct Node{
  int key;
  Node *right,*left,*parent;
};
Node *root,*NIL;
 
Node * tmin(Node *x){
  while(x->left!=NIL)x=x->left;
  return x;
}
Node * treeSuccessor(Node *x){
  if(x->right!=NIL)return tmin(x->right);
  Node *y=x->parent;
  while(y!=NIL&&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
 
void tdel(Node *z){
  Node *y;
  Node *x;
 
  if(z->left==NIL||z->right==NIL)y=z;
  else y=treeSuccessor(z);
  if(y->left!=NIL){
    x=y->left;
  }
  else{
    x=y->right;
  }
  if(x!=NIL){
    x->parent = y->parent;
  }
  if(y->parent==NIL){
    root=x;
  }
  else{
    if(y==y->parent->left){
      y->parent->left=x;
    }
    else{
      y->parent->right=x;
    }
  }
  if(y!=z){
    z->key = y->key;
  }
  free(y);
}
 
Node * find(Node *u,int k){
  while(u != NIL && k!=u->key){
    if(k<u->key)u=u->left;
    else u = u -> right;
  }
  return u;
}
void insert(int k){
    Node *y = NIL;
  Node *x = root;
  Node *z;
  z=(Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent = y;
  if(y==NIL){
    root = z;
  }else{
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}
void inorder(Node *u){
  if(u==NIL)return;
  inorder(u->left);
  cout << " " << u->key;
  inorder(u->right);
}
void preorder(Node *u){
  if(u==NIL)return;
  cout << " " << u->key;
  preorder(u->left);
  preorder(u->right);
}
int main(){
  int n,m;
  string func;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> func;
    if(func=="find"){
      cin >> m;
      Node *t=find(root,m);
      if(t!=NIL)cout << "yes" << endl;
      else cout << "no" << endl;
    }
    else if(func=="insert"){
      cin >> m;
      insert(m);
    }
    else if(func=="print"){
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    }
    else if(func=="delete"){
      cin >> m;
      tdel(find(root,m));
    }
  }
  return 0;
   
}


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

int main(){
    int a,b,c,x;
    cin >> a >> b >> c >> x;

    int count = 0;

    for(int i = 0;i <= a && 500*i <= x;i ++){
        for(int j = 0;j <= b && 500*i + 100*j <= x;j ++){
            if(50*c >= x - 500*i -100*j){
                count ++;
            }
        }
    }

    cout << count << endl;
}

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

namespace ABC098 {
	class ABC092_A {
		static void Main(string[] args) {
			var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			var results = new List<int>();
			results.Add(input[0] + input[1]);
			results.Add(input[0] - input[1]);
			results.Add(input[0] * input[1]);
			results.Sort();
			Console.WriteLine(results.Last());
		}
	}
}


Measured memory_bytes: 13396
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
    for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
bool  a = false;
sort(A.begin(), A.end());
    for(int j = 1;j<N;j++){
      if(A.at(j) == A.at(j-1)){
        a = true;
        break;
      }
    }
  if(a){
    cout << "NO" << endl;
  }
  else{
    cout << "YES" << endl;
  }
}

Measured memory_bytes: 1024
H, W = map(int, input().split())
a = [input() for _ in range(H)]
count = 0
while True:
  length = len(a)
  a = [i for i in a if not(len(set(i)) == 1 and i[0] == '.')]
  if len(a) == length:
    break
  a = list(zip(*a))
  count += 1
if count % 2 != 0: a = list(zip(*a))
[print(''.join(i)) for i in list(a)]

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int a, b; cin >> a >> b;
    cout << (a + b) % 24 << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using     ll=long long;
using    vll=vector<   ll>;
using   vvll=vector<  vll>;
using  vvvll=vector< vvll>;
using vvvvll=vector<vvvll>;
constexpr ll INF = 1LL << 60;
struct Fast{ //cin,cout高速化のおまじない＋桁数指定
	Fast(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(std::numeric_limits<double>::max_digits10); }
} fast;
#define rep(i, S, E)  for (ll i = (S); i <= (E); i++)
#define dep(i, E, S)  for (ll i = (E); i >= (S); i--)
#define each(e, v) for (auto&& e : v)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }return false; }
template<class T> inline T MaxE(vector<T>&v,ll S,ll E){ T m=v[S]; rep(i,S,E)chmax(m,v[i]); return m; }
template<class T> inline T MinE(vector<T>&v,ll S,ll E){ T m=v[S]; rep(i,S,E)chmin(m,v[i]); return m; }
template<class T> inline T MaxE(vector<T> &v) { return MaxE(v,0,(ll)v.size()-1); }
template<class T> inline T MinE(vector<T> &v) { return MinE(v,0,(ll)v.size()-1); }
template<class T> inline T Sum(vector<T> &v,ll S,ll E){ T s=T(); rep(i,S,E)s+=v[i]; return s; }
template<class T> inline T Sum(vector<T> &v) { return Sum(v,0,v.size()-1); }
template<class T> inline ll sz(T &v){ return (ll)v.size(); }
template<class T> inline T POW(T a, ll n){ T r=1; for (; n>0; n>>=1, a*=a){ if (n&1)r*=a; } return r; }
inline ll POW(int a, ll n){ return POW((ll)a, n); }
inline ll CEIL(ll a, ll b){ return (a+b-1)/b; }


void solve()
{
	ll Q=100000;
	ll n,m;  cin >> n >> m;
	vector<ll> x(n);  rep(i,0,n-1){ ll x_; cin>>x_; x[i]=x_; }

	vll cnt(Q+1);
	each(e,x){
		cnt[e]++;
	}

	vll re(m+1);
	each(e,x){
		re[e%m]++;
	}

	ll ans=0;
	rep(i,0,m/2){
		if (i==0 or (m%2==0 and i==m/2)){
			ans+=re[i]/2;
			re[i]%=2;
			continue;
		}

		ll v=min(re[i],re[m-i]);
		ans+=v;
		re[i]-=v;
		re[m-i]-=v;
	}

	rep(i,1,m-1){
		if (re[i]<=1) continue;

		ll sm=0;
		rep(j,0,Q){
			ll ii=i+j*m;
			if (ii>Q) break;

			sm+=cnt[ii]/2;
		}

		ans+=min(re[i]/2,sm);
	}
	cout << ans << '\n';
}


int main(){
#if 1
	solve();
#else
	ll t;  cin >> t;
	rep(i, 0, t-1){
		solve();
	}
#endif
	return 0;
}


Measured memory_bytes: 5484