akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;

 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}




 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  int d,g;
    cin>>d>>g;
  vll A(d);
  vll B(d);
  FOR(i,1,d+1){
    ll a,b;
      cin>>a>>b;
    A[i-1]=100*a*i+b;//全完したら何点か
    B[i-1]=a;//何回か
    //cout<<A[i-1]<<" "<<B[i-1]<<endl;
  }
  int ans=100000;
  //bit全探索
  for(int bit=0;bit<(1<<d);bit++){
      int now=0;//今の時点での合計点
      int count=0;//今の時点での回数
      int half=0;//中途半端に解く問題の点数
      bl b=true;

    for(int i=d-1;i>=0;i--){

      if(bit&(1<<i)){
        now+=A[i];
        count+=B[i];
      }//全完するのは選んだ

      else if(b){
        half=i;
        b=false;
        //cout<<half<<endl;
      }//中途半端に解くのを選ぶ
    }
      int n=B[half];
    for(int j=0;j<=n;j++){
      if(now>=g){
         chmin(ans,count);
         break;
      }

      else{
        now+=(half+1)*100;
        count++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n, a, b = list(map(int, input().split()))
s = str(input())

a_b = a + b
for i in range(n):
    if s[i] == 'a':
        a_b = a_b - 1
        if a_b >= 0:
            print('Yes')
        else:
            print('No')

    elif s[i] == 'b':
        b = b - 1
        if b >= 0:
            a_b = a_b - 1
            if a_b >= 0:
                print('Yes')
            else:
                print('No')
        else:
            print('No')

    elif s[i] == 'c':
        print('No')


Measured memory_bytes: 4016
#include <bits/stdc++.h>
#define rep(i, n) for (ll 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> l(n);
  rep(i, n) cin >> l[i];
  sort(l.begin(), l.end());
  int cnt = 0;
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      for (int k = j + 1; k < n; k++) {
        if (l[i] != l[j] && l[j] != l[k]) {
          if (l[i] + l[j] > l[k]) cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


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

using namespace std;

int main()
{
    int a,b,sum=0;
    cin>>a>>b;
    sum=a+b;
    if(sum<10)
    {
        cout<<sum;
    }
    else
    {
        cout<<"error\n";
    }
    return 0;

}


Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int cur = 1;
      for (int t = j - i; t % 2 == 0; t /= 2) ++cur;
      printf("%d%c", cur, " \n"[j + 1 == n]);
    }
  }
  return 0;
}


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

int main(){
  multiset<int, greater<int> > mts{};
  for(int i = 0; i < 10; i++){
    int tmp = 0;
    scanf("%d", &tmp);
    mts.insert(tmp);
  }
  int count = 0;
  for(int const mt : mts){
    printf("%d\n", mt);
    if(++count >= 3) break;
  }
  return 0;
}

Measured memory_bytes: 1016
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 105

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


int main() {

	string s;
	cin >> s;
	int siz = s.size();
	string t, k;
	for (int i = 0; i < siz; i++)
	{
		if ((i % 2) == 0)
		{
			t.push_back('0');
		}
		else
		{
			t.push_back('1');
		}
	}

	for (int i = 0; i < siz; i++)
	{
		if ((i % 2) == 0)
		{
			k.push_back('1');
		}
		else
		{
			k.push_back('0');
		}
	}

	int ans = INF;
	int cnt = 0;
	for (int i = 0; i < siz; i++)
	{
		if (s[i] != t[i])
		{
			cnt++;
		}
	}

	ans = min(ans,cnt);
	cnt = 0;

	for (int i = 0; i < siz; i++)
	{
		if (s[i] != k[i])
		{
			cnt++;
		}
	}
	ans = min(ans, cnt);

	cout << ans << endl;

}

Measured memory_bytes: 640
#include<stdio.h>
 
#define MAXLEN 20000
 
int garea,gareas[(MAXLEN/2)+1],gcnt;
 
 
int getArea( char *inputs, int start, int end )
{
    int i;
    int ravine,water;
    
    gareas[gcnt]=ravine=water=0;
    for( i=start; i!=end; i++ ) {
        if( '\\'== *(inputs+i) ) {
            ravine++;
            water++;
           	water+=((ravine-1)*2);
        } else if( 0 != ravine && '/' == *(inputs+i) ) {
        	ravine--;
        } else {
	     	gareas[gcnt]+=ravine;
        }       
    }
	gareas[gcnt]+=water;
    
    return gareas[gcnt];
}
  
int checkRavine( char *inputs, int start )
{
    int i;
    int ravine;
    
    ravine=0;
    for( i=start; '\0'!=*(inputs+i); i++ ) {
        if( '\\'== *(inputs+i) ) {
            ravine++;
        } else if( 0 != ravine && '/' == *(inputs+i) ) {   
            ravine--;
            if( 0 == ravine ) {
            	garea+=getArea( inputs, start, i+1 );
            	gcnt++;
                return i-start;
            }           
        }
    }
    return 0;
}
 
 
void getAreas( char *inputs )
{
    int i,next;
     
    next=0;
    for( i=0; '\0'!=inputs[i]; i++ ) {
        next=checkRavine( inputs, i );
        i+=next;
    }
 
    return;
}
 
int main( void ) 
{
    char inputs[MAXLEN+1];
    int i;
 
    scanf( "%s", inputs );
    garea=gcnt=0;
    getAreas( inputs );
     
    printf( "%d\n", garea );
    
    if( gcnt ) {
        printf( "%d ", gcnt );
        for( i=0; i<gcnt; i++ ) {
            printf( "%d", gareas[i] );
            if( i < gcnt-1 ) {
            	printf( " " );  
            }
        }
        printf( "\n" );
       
    } else {
        printf( "0\n" );
    }
     
    return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  for(int i=0; i<m; i++) {
    int a;
    cin >> a;
    sum += a;
  }
  if((n-sum) < 0) {
    cout << -1 << endl;
    return 0;
  }
  
  cout << n - sum << endl;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<algorithm>

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

using namespace std;

typedef long long ll;

const ll INF=1LL<<61;

int main(){
	for(int n;scanf("%d",&n),n;){
		int I[100];
		ll sat[100];
		rep(i,n){
			I[i]=0;
			int m; scanf("%d%lld",&m,sat+i);
			rep(j,m){
				int s,e; scanf("%d%d",&s,&e);
				for(int k=s;k<e;k++) I[i]|=1<<(k-6);
			}
		}

		static ll dp[101][1<<16];
		rep(i,n+1) rep(S,1<<16) dp[i][S]=(i==0&&S==0?0:-INF);
		rep(i,n) rep(S,1<<16) {
			dp[i+1][S]=max(dp[i+1][S],dp[i][S]);
			if((S&I[i])==0) dp[i+1][S|I[i]]=max(dp[i+1][S|I[i]],dp[i][S]+sat[i]);
		}
		printf("%lld\n",*max_element(dp[n],dp[n]+(1<<16)));
	}

	return 0;
}

Measured memory_bytes: 51000
fun main(args: Array<String>) {
    val rgbn = readLine()!!.split(" ").map { it.toInt() }
    val n = rgbn[3]
    val (r,g,b) = rgbn.take(3)

    (0..n step r).map { R->
        (R..n step g).count{ (n-it)%b==0 }
    }.sum().let { println(it) }

}



Measured memory_bytes: 38748
#include <iostream>
#include <unordered_set>
using namespace std;
class Door {
  public:
    bool isOpened;
    void openedBy(string id) {
      isOpened = true;
      cout << "Opened by " << id << endl;
    }
    void closedBy(string id) {
      isOpened = false;
      cout << "Closed by " << id << endl;
    }
    void toggledBy(string id) {
      (isOpened) ? closedBy(id) : openedBy(id);
    }
};

int main() {
  unordered_set<string> registedIds;
  int nRegistedIds;
  cin >> nRegistedIds;
  for(int i = 0; i < nRegistedIds; ++i) {
    string id;
    cin >> id;
    registedIds.insert(id);
  }
  Door door;
  int nTryIds;
  cin >> nTryIds;
  for(int i = 0; i < nTryIds; ++i) {
    string id;
    cin >> id;
    if(registedIds.find(id) != registedIds.end()) {
      door.toggledBy(id);
    } else {
      cout << "Unknown " << id << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <unordered_map>

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

using namespace std;

int main(){
    int n,k; cin >> n >> k;
    if((n-1)*(n-2)/2 < k) {
        cout << "-1" << endl;
        return 0;
    }
    int diff = (n-1)*(n-2)/2 -k;
    cout << n-1 + diff << endl;
    for(int i = 2; i <= n; i++){
        cout << 1 << " " << i << endl;
    }
    for(int i = 2; i < n; i++){
        for(int j = i+1; j <=n; j++){
            if(i == j)
                continue;
            if(diff == 0)
                return 0;
            cout << i << " " << j << endl;
            diff--;
        }
    }
}



Measured memory_bytes: 256
int main(void){
  int n,x,y,h,w,len,total;
  int a,b,c;

  while(1){
    scanf("%d",&n);
    if(!n) break;

    total = 0;
    while(n--){
      scanf("%d%d%d%d",&x,&y,&h,&w);
      len = x+y+h;

      a = (len-1)/20 - 2;
      if(a<0)a=0;
      if(a>5)a=6;

      b = (w-1)/5+1;
      if(w<3)b=0;
      if(b>5)b=6;

      if(a>b)c=a;
      else c=b;

      if(c!=6)total += 600+200*c;
    }
    printf("%d\n",total);
  }

  return 0;
}

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

int main() {
	string a, b;
	cin >> a >> b;
	int x = stoi(a + b);
	for (int i = 0; i <= 1000; i++) {
		if (i * i == x) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int  k;
ll ans;
int main()
{

cin>>k;
for(int a=1;a<=k;a++)
   for(int b=1;b<=k;b++)
        for(int c=1;c<=k;c++)
{
ans+=__gcd(__gcd(a,b),c);	
}
cout<<ans;
return 0;

}

Measured memory_bytes: 3636
n,k,q=map(int,input().split())
a=[int(input())for i in range(q)]
b=[0 for i in range(n)]
ans=0
point=[k-len(a) for i in range(n)]
for i in range(q):
    b[a[i]-1]+=1
for i in range(n):
    if 0<point[i]+b[i]:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 12580
import java.util.Scanner;
class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		while(scan.hasNextInt()){
			int d = scan.nextInt();
			int sum = 0;
			
			for(int i=d;i<600-d;i+=d){
				sum = sum+(i*i*d);
			}
			sum = sum+((600-d)*(600-d)*d);
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 17184
#include "bits/stdc++.h"

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  vector <vector <int> > A(n);
  for(int i=0; i<n; i++) {
    A[i].resize(n-1);
    for(int j=0; j+1<n; j++) {
      cin >> A[i][j];
      A[i][j]--;
    }
  }
  bool pat = true;
  int ret = -1;
  vector <int> wsk(n);
  while(true) {
    ret++;
    vector <bool> done(n);
    for(int j=0; j<n; j++) {
      if(wsk[j] == n-1) continue;
      int rywal = A[j][wsk[j]];
      if(done[j] or done[rywal]) continue;
      if(A[rywal][wsk[rywal]] == j) {
        done[rywal] = true;
        done[j] = true;
        wsk[rywal]++;
        wsk[j]++;
        pat = false;
      }
    }
    if(pat) break;
    pat = true;
  }
  for(int i=0; i<n; i++) if(wsk[i] != n-1) ret = -1;
  cout << ret << "\n";

}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int N, M;
int coin[20];
int dp[50001];

int main() {
	scanf("%d %d", &N, &M);
	rep(i, M) scanf("%d", &coin[i]);
	rep(i, N + 1) dp[i] = INF;
	dp[0] = 0;
	rep(i, M) FOR(j, coin[i], N + 1) {
		if(j - coin[i] >= 0) {
			dp[j] = min(dp[j - coin[i]] + 1, dp[j]);
		}
	}
	printf("%d\n", dp[N]);
	return 0;
}

Measured memory_bytes: 3344
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x;
    cin >> a >> b >> c >> x;
  int ans = 0;
  for(int i = 0;i <= a;i++){
    for(int j = 0;j <= b;j++){
      for(int k = 0;k <= c;k++){
        if(x == i * 500 + j * 100 + k * 50){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    int w[n] = {}, e[n] = {};
    for (int i = 1 ; i < n ; i++) {
    	if (s[i - 1] == 'W') {
    		w[i] = w[i - 1] + 1;
		}
		else w[i] = w[i - 1];
	} 
	for (int i = n - 2 ; i >= 0 ; i--) {
    	if (s[i + 1] == 'E') {
    		e[i] = e[i + 1] + 1;
		} 
    	else e[i] = e[i + 1];
  	}	
  	int m = n;
  	for (int i = 0 ; i < n ; i++) {
  		m = min(m, w[i] + e[i]);
	}
	cout << m;
}

Measured memory_bytes: 6108
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define uni(q) unique(all(q)),q.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n,k; cin >> n >> k;
    vl x(n);
    ll index0 = -1;
    rep(i,n){
        cin >> x[i];
        if(x[i] >= 0 && index0 == -1){
            index0 = i;
        }
    }
    ll mn = INF;
    if(index0 == -1){
        mn = abs(x[n-k]);
    }else{
        for(ll i=index0; i+k-1>=index0; i--){
            if(i<0) break;
            if(i+k-1 >= n) continue;
            if(x[i] * x[i+k-1] < 0){
                if(abs(x[i]) > x[i+k-1]){
                    mn = min(mn, 2*x[i+k-1] - x[i]);
                }else{
                    mn = min(mn, x[i+k-1] - 2*x[i]);
                }
            }else{
                mn = min(mn, max(abs(x[i+k-1]), abs(x[i])));
            }
        }
    }
    cout << mn << endl;
}


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


int main()
{
    int w,h,n;
    cin >> w >> h >> n;
    int xmin = 0, xmax = w, ymin = 0, ymax = h;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  int n,w,h; cin>>n>>w>>h;
  cout << (n-w+1)*(n-h+1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int N,P,cur,t=1,cnt[10010],i;char S[200010];long long ans;
int main()
{
    scanf("%d%d%s",&N,&P,S);
    if(P==2||P==5){
        for(i=0;i<N;i++)if((S[i]-'0')%P==0)ans+=i+1;
    }else{
        cnt[0]=1;
        for(i=N-1;i>=0;i--){
            (cur+=(S[i]-'0')*t)%=P;
            ans+=cnt[cur]++;
            t=t*10%P;
        }
    }
    printf("%lld",ans);
}

Measured memory_bytes: 384
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a,b,c,d = I()
while a > 0 and c > 0:
    c -= b
    a -= d

if c <= 0:
    print("Yes")
else:
    print("No")


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

long long H, W, sx, sy, gx, gy, dist1[509][509], dist2[509][509]; char c[509][509];

int main() {
	cin >> W >> H;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			cin >> c[i][j]; dist1[i][j] = (1LL << 60); dist2[i][j] = (1LL << 60);
			if (c[i][j] == 's') { sx = i; sy = j; }
			if (c[i][j] == 'g') { gx = i; gy = j; }
		}
	}
	int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; queue<pair<int, int>>Q;
	dist1[gx][gy] = 0; Q.push(make_pair(gx, gy));

	while (!Q.empty()) {
		pair<int, int>a1 = Q.front(); Q.pop();
		int cx = a1.first, cy = a1.second;

		for (int i = 0; i < 4; i++) {
			int px = cx + dx[i], py = cy + dy[i];
			if (c[px][py] == '#' || c[px][py] == '*') continue;
			if (dist1[px][py] > dist1[cx][cy] + 1) {
				dist1[px][py] = dist1[cx][cy] + 1;
				Q.push(make_pair(px, py));
			}
		}
	}

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (c[i][j] == '*') { dist2[i][j] = 0; Q.push(make_pair(i, j)); }
		}
	}
	if (Q.empty()) {
		cout << dist1[sx][sy] << endl;
		return 0;
	}

	while (!Q.empty()) {
		pair<int, int>a1 = Q.front(); Q.pop();
		int cx = a1.first, cy = a1.second;

		for (int i = 0; i < 4; i++) {
			int px = cx + dx[i], py = cy + dy[i];
			if (c[px][py] == '#') continue;
			if (dist2[px][py] > dist2[cx][cy] + 1) {
				dist2[px][py] = dist2[cx][cy] + 1;
				Q.push(make_pair(px, py));
			}
		}
	}
	
	long double L = 0.0L, R = 1e12, M;
	for (int i = 0; i < 100; i++) {
		M = (L + R) / 2;
		int cnt = 0; long double sum = 0;
		for (int j = 1; j <= H; j++) {
			for (int k = 1; k <= W; k++) {
				if (c[j][k] == '#' || c[j][k] == '*' || c[j][k] == 'g') continue;
				cnt++;
				sum += min(M + 1.0L*dist2[j][k], 1.0L*dist1[j][k]);
			}
		}
		if ((1.0L*sum / cnt) < M) { R = M; }
		else { L = M; }
	}
	printf("%.12Lf\n", min(M + 1.0L*dist2[sx][sy], 1.0L * dist1[sx][sy]));
	return 0;
}


Measured memory_bytes: 7568
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? (-(a)) : (a))

using namespace std;

int main()
{
	vector<int> input;
	for (int i = 0; i < 3; ++i)
	{
		int temp;
		scanf("%d", &temp);
		input.push_back(temp);
	}
	sort(input.begin(), input.end());

	if ((input[0] == input[1] && input[0] != input[2]) || ((input[1] == input[2]) && (input[1] != input[0]))) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int i,j,n,m,a[1000],S,S1;

  while(1)
    {
      scanf("%d%d",&n,&m);
      if(n==0&&m==0) break;
      for(i=0;i<=n-1;i++)
	{
	  scanf("%d",&a[i]);
	}
      S1=0;
      for(i=0;i<=n-1;i++)
	{
	  for(j=i+1;j<=n-1;j++)
	    {
	      S=a[i]+a[j];
	      if(S<=m && S1<S) S1=S;
	    }
	}
      if(S1==0) printf("NONE\n");
      else printf("%d\n",S1);
    }
  return 0;
}


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

int main(){
  char S;
  cin >> S;
  if (S=='a' || S=='i' || S=='u' || S=='e' || S=='o'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
/* Shorthands */
#define ll long long
#define pb push_back 
#define mp make_pair
#define sp " "
#define cs "Case "
#define fi first
#define sn second 
#define po(x) x*x
/* STL */
#define vi vector<int>v
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mem(a,n) memset(a, n, sizeof(a));
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define sz(x)  (int)x.size()
#define mx(v)  *max_element(v.begin(),v.end())
#define mxi(v) distance(v.begin(),max_element(v.begin(),v.end()))
#define mxa(a) *max_element(a, a.size())
#define r(a) reverse(a.begin(),a.end())
/* loops */
#define fr(i,n)   for(__typeof(n) i=0;i<(n);i++)
#define fn(i,n)   for(__typeof(n)i=1;i<=(n);i++)
#define fa(i,a,n) for(ll  i=(ll)(a);i<=(ll)(b);i++)
/*Special*/
#define Ezio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(something)  cerr<<#something<<" - "<<something<<"\n";         

int main()
{
  
   Ezio
   ll t,m,n,x,a,b,c;
   string s;
   
   cin>>n;
   vector<ll>v(n+1);
   
   for(ll i=1;i<=100;i++){
     for(ll j=1;j<=100;j++){
       for(ll k=1;k<=100;k++){
         m= i*i + j*j + k*k + i*j + i*k + j*k;
         if(m<=n){
           v[m]++;
         }
       }
     }
   }
   
   fn(i,n){
     cout<<v[i]<<endl;
   }
   return 0;
}
    

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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;
#include <cstdint>

class RollingHash {
 public:
  void Add(int i) {
    const uint64_t base = 100000007;
    hash_ = hash_ * base + i;
  }
  uint64_t hash() const { return hash_; }
  bool operator==(const RollingHash& h) const { return hash_ == h.hash_; }

 private:
  uint64_t hash_ = 0;
};

namespace std {
template <>
class hash<RollingHash> {
 public:
  size_t operator()(const RollingHash& h) const {
    return hash<uint64_t>()(h.hash());
  }
};
}  // namespace std

using namespace std;

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

  rd(int, n);

  V<string> s(n);
  rep(i, n) {
    cin >> s[i];
    reverse(all(s[i]));
  }
  sort(all(s), [](auto &a, auto &b) { return a.size() > b.size(); });

  ll ans = 0;
  unordered_map<RollingHash, array<int, 26>> m;
  for (auto &si : s) {
    vector<bitset<26>> cum(si.size() + 1);
    for (int i = si.size() - 1; i >= 0; --i) {
      cum[i] = cum[i + 1];
      cum[i].set(si[i] - 'a');
    }
    RollingHash h;
    rep(i, si.size() - 1) {
      rep(j, 26) {
        if (cum[i][j]) {
          m[h][j]++;
        }
      }
      h.Add(si[i]);
    }
    ans += m[h][si.back() - 'a'];
  }
  wt(ans);
}


Measured memory_bytes: 156816
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc  =  new Scanner(System.in);
        int i, v, j, count, n = sc.nextInt();
        int[] a = new int[n];
        for(i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }
        for(i = 0; i < n ; i++){
            count = 0;
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
                a[j+1] = v;
            }
            for(int answer: a){
                count++;
                if(count > n-1)System.out.println(answer);
                else System.out.print(answer+" ");
                
            }
        }
    }
}



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

#define ll long long
#define int ll

int32_t main() {
	int n, a, b; cin >> n >> a >> b;
  	int sum = a + b;
  	int times = n / sum;
  	int rem = n % (sum);
  	int sol = a*times + (min(rem, a));
  	cout << sol << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;

int main(){
	int n;
	while(~scanf("%d",&n)){
		int pages[50];
		for(int i=0;i<n;i++){
			scanf("%d",pages+i);
		}

		vector<P> pset;
		for(int i=0;i<n;){
			int start = i;
			int end = i;
			for(int j=i+1;j<n;){
				if(abs(pages[j] - pages[j-1])>1){
					i=j;
					break;
				}
				else{
					end = j;
					j++;
				}
			}
			pset.push_back(P(pages[start],pages[end]));
			i=end+1;
		}

		for(int i=0;i<pset.size();i++){
			if(pset[i].first != pset[i].second){
				printf("%d-%d%s",pset[i].first,pset[i].second,i==pset.size()-1 ? "\n" : " ");
			}
			else
			{
				printf("%d%s",pset[i].first,i==pset.size()-1 ? "\n" : " ");
			}
		}
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repA(i,n) for(int i=n; i>=0; i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (int)(a.size())
typedef long long ll;
const ll mod = 1e9+7;//998244353
int t = 1;
/*
int rooms,psgs;
vector<int> a[(int)1e5 + 3];
vector<int> p((int)1e5 + 3 , 0);
vector<bool> v((int)1e5 + 3, false);

void dfs(int cur) {
  vector<int>
  for(auto &i:a[cur]) {
    if(v[i])  continue;
    p[i] = cur;
    v[i]=true;
  }
}*/

void solve(int BYasD) {
  ll a,b;
  cin>>a>>b;
  cout<<(a*b);
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  #endif
  //cin>>t;
  rep(i,t)  {
  //  cout<<"Case #"<<(i+1)<<'\n';
    solve(i);
    //cout<<'\n';
  }
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    rep(i,3){
        if(S[i] == '1')cout << "9";
        else if(S[i] == '9')cout << "1";
        else cout << S[i];
    }
    cout << endl;
}

Measured memory_bytes: 3616
/*
 　　　　　／＞　 フ
 　　　　　| 　_　 _|
 　 　　　／`ミ _x 彡
 　　 　 /　　　 　 |
 　　　 /　  ヽ　　 ?
 　／￣|　　 |　|　|
 　| (￣ヽ＿_ヽ_)_)
 　＼二つ
  */

#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;

template <typename T>
void read(T &x) {
    x = 0; bool f = 0;
    char c = getchar();
    for (;!isdigit(c);c=getchar()) if (c=='-') f=1;
    for (;isdigit(c);c=getchar()) x=x*10+(c^48);
    if (f) x=-x;
}

template<typename F>
inline void write(F x, char ed = '\n') {
    static short st[30];short tp=0;
    if(x<0) putchar('-'),x=-x;
    do st[++tp]=x%10,x/=10; while(x);
    while(tp) putchar('0'|st[tp--]);
    putchar(ed);
}

template <typename T>
inline void Mx(T &x, T y) { x < y && (x = y); }

template <typename T>
inline void Mn(T &x, T y) { x > y && (x = y); }

const int N = 3050;
const int P = 1e9 + 7;
const int inv2 = (P + 1) >> 1;
int A[N][N], a[N], n, q;
inline ll add(int x, int y) { return x + y >= P ? x + y - P : x + y; }
void out(void) {
    for (int i = 1;i <= n; i++, puts(""))
        for (int j = 1;j <= n; j++)
            write(A[i][j], ' ');
    puts("");
}
int main() {
    read(n), read(q);
    for (int i = 1;i <= n; i++) read(a[i]);
    for (int i = 1;i <= n; i++)
        for (int j = 1;j <= n; j++) 
            A[i][j] = a[i] > a[j];
    /* puts(""); */
    ll mi = 1;
    for (int i = 1, x, y;i <= q; i++) {
        /* out(); */
        mi = add(mi, mi);
        read(x), read(y);
        /* if (x > y) swap(x, y); */
        for (int i = 1;i <= n; i++) {
            if (i == x || i == y) continue;
            int tx = A[x][i], ty = A[y][i];
            int ttx = A[i][x], tty = A[i][y];
            A[x][i] = A[y][i] = add(tx, ty) * inv2 % P;
            A[i][y] = A[i][x] = add(ttx, tty) * inv2 % P;
        }
        A[x][y] = A[y][x] = (ll)inv2 * add(A[x][y], A[y][x]) % P;
    }
    /* out(); */
    int ans = 0;
    for (int i = 1;i <= n; i++) 
        for (int j = i + 1;j <= n; j++)
            ans = add(ans, A[i][j]);
    /* write(ans); */
    write(1ll * ans * mi % P);
    return 0;
}

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

namespace AtCorder1
{
	class Program
	{
		static void Main(string[] args)
		{
			Console.WriteLine(Test(Console.ReadLine().ToList()));
		}

		private static String Test(IEnumerable<char> s)
		{
			var ls = new List<int>();

			do
			{
				var r = s.TakeWhile(t => t == 'R').Count();
				var l = s.Skip(r).TakeWhile(t => t == 'L').Count();
				int h = (r + l) / 2;
				var e = (r + l) % 2 == 0;
				ls.AddRange(Enumerable.Repeat(0, r - 1)
					.Append(e ? h : h + (r % 2))
					.Append(e ? h : h + (l % 2))
					.Concat(Enumerable.Repeat(0, l - 1)));

				s = s.Skip(r + l);
			} while (s.Any());

			return String.Join(" ", ls);
		}
	}
}

Measured memory_bytes: 47184
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,no;
  cin>>n;
  int d=0;
  for(int i=1;i<=n;i++)
  {
   no=floor(log10(i)+1);\
     if(no%2!=0)
     {
       d++;
     }

  }
  cout<<d;
}


Measured memory_bytes: 384
def main():
    N = int(input())
    s = input()

    acc = []
    t = [0] * 26
    for c in s:
        i = ord(c) - ord('a')
        t[i] += 1
        acc.append(t.copy())

    ans = 0
    for i in range(N - 1):
        left = acc[i]
        right = [cn - ci for ci, cn in zip(acc[i], acc[N - 1])]
        cnt = 0
        for ci in range(26):
            if left[ci] and right[ci]:
                cnt += 1
            ans = max(ans, cnt)
    print(ans)


if __name__ == '__main__':
    main()


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


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

  ll ac = a * c, ad = a * d, bc = b * c, bd = b * d;
  ll maxi = max( max( ac, ad ), max( bc, bd ) );

  cout << maxi << endl;

  return 0;
}
/*
*/


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n,m; cin>>n>>m;
    ll ans=0;
    bool graph[10][10]={};
    rep(i,m){
        ll a,b; cin>>a>>b;
        a--; b--;
        graph[a][b]=graph[b][a]=true;
    }
    vector<ll> p(n);
    rep(i,n) p[i]=i;
    do{
        bool ok=true;
        if(p[0]!=0) break;
        rep(i,n-1){
            if(!graph[p[i]][p[i+1]]) ok=false;
        }
        if(ok) ++ans;
    }while(next_permutation(all(p)));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
 
int main(void)
{
 
 long a;
 long b;
 long k;

scanf("%ld %ld %ld",&a,&b,&k);

if(a-k>0){
 printf("%ld %ld\n",a-k,b);
}else if(b-(k-a)>0){
  printf("0 %ld\n",b-k+a);
}else{
  printf("0 0\n");
}

  return 0;
}


Measured memory_bytes: 760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();

		if (a > b) {
			if (b == 1) {
				System.out.println("Bob");
			} else {
				System.out.println("Alice");
			}
		} else if (a < b) {
			if (a == 1) {
				System.out.println("Alice");
			} else {
				System.out.println("Bob");
			}
		} else if (a == b) {
			System.out.println("Draw");
		}

	}

}

Measured memory_bytes: 21844
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] d = new int[n];
		int i = 0;
		for(i = 0; i < n; i++) {
			d[i] = scan.nextInt();
		}
		Arrays.sort(d);
		int count = 1;
		for(i = 0; i < n - 1; i++) {
			if(d[i] < d[i + 1]) {
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21716
H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]
ans = []

for h in range(H-1):
	for w in range(W-1):
		if a[h][w] % 2 == 1:
			ans.append([h+1, w+1, h+1, w+2])
			a[h][w+1] += 1
	if a[h][-1] % 2 == 1:
		ans.append([h+1, W, h+2, W])
		a[h+1][-1] += 1

for w in range(W-1):
	if a[H-1][w] % 2 == 1:
		ans.append([H, w+1, H, w+2])
		a[H-1][w+1] += 1

print(len(ans))
for an in ans:
	print(*an)

Measured memory_bytes: 32244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(ll i = a; i < b; i++)
typedef pair<ll,ll> P;

const ll MAX_N = 305;
const ll INF = 1e11;
vector<P> query;

ll cost[MAX_N][MAX_N];
P dist[MAX_N][MAX_N];
bool visited[MAX_N];
ll N, L, Q;
ll ans[MAX_N];

void dijkstra(ll s){
    fill(visited, visited + N, false);
    dist[s][s] = {0, 0};

    while(true){
        ll v = -1;
        //まだ使われていない頂点のうち最小のものを探す
        for(int nv = 0; nv < N; nv++){
            if(!visited[nv] && (v == -1 || dist[s][v] > dist[s][nv])) v = nv;
        }
        if(v == -1) break;
        visited[v] = true;

        for(int nv = 0; nv < N; nv++){
            if(nv == v) continue;
            if(cost[v][nv] == INF) continue;
            if(visited[nv]) continue;

            P ndis;
            if(dist[s][v].second + cost[v][nv] > L) ndis = {dist[s][v].first + 1, cost[v][nv]};
            else ndis = {dist[s][v].first, dist[s][v].second + cost[v][nv]};
            if(dist[s][nv] > ndis) dist[s][nv] = ndis;
        }
    }

    /* rep(i, 0, N){
        cout << i << " " << cnt[i] << endl;
    } */

/*     rep(i, 0, Q) if(query[i].first == s){
        if(dist[query[i].second].first >= INF) ans[i] = -1;
        else ans[i] = dist[query[i].second].first;
    } */
}

int main(){
    ll M; cin >> N >> M >> L;
    rep(i, 0, N) rep(j, 0, N) cost[i][j] = INF;
    rep(i, 0, N) cost[i][i] = 0;
    rep(i, 0, M){
        ll a, b, c; cin >> a >> b >> c;
        if(c > L) continue;
        a--, b--;
        cost[a][b] = c;
        cost[b][a] = c;
    }
    //cin >> Q;
    //query.resize(Q);
    //rep(i, 0, Q) cin >> query[i].first >> query[i].second, query[i].first--, query[i].second--;

    rep(i, 0, N) rep(j, 0, N) dist[i][j] = {INF, INF};
    rep(i, 0, N) dijkstra(i);

    int Q;cin>>Q;
	while(Q--){
		int s,t;cin>>s>>t;s--, t--;
		if (dist[s][t]<make_pair(INF,INF)) cout << dist[s][t].first << endl;
		else cout<<-1<<endl;
	}
}

Measured memory_bytes: 2688
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }


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

    // ifstream fin(".in");
    // ofstream fout(".in");
  i64 n;
  vi64 a;
  cin>>n;
  forn(i,n)
  {
    i64 v;
    cin>>v;
    a.pb(v);

  }
  i64 c=0;
  for1(i,n-2)
  {
i64 mx=max(a[i-1],max(a[i],a[i+1]));
i64 mn=min(a[i-1],min(a[i],a[i+1]));
if(a[i]>mn&&a[i]<mx)
c++;
    }
cout<<c;

    return 0;
  }


Measured memory_bytes: 256
N,M=map(int,input().split())
S=[list(map(int,input().split())) for _ in range(M)]
P=list(map(int,input().split()))

ans=0
for i in range(1<<N):
  sw=[False]*M
  for j in range(M):
    cnt=0
    for k in range(1,len(S[j])):
      if (i>>(S[j][k]-1))&1:
        cnt+=1
      else:
        flag=0
    if cnt%2==P[j]:
      sw[j]=True
  if all(sw):
    ans+=1
print(ans)

Measured memory_bytes: 9084
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 8000

int ans_x,ans_y;
char buf[8010];
short dp[4001][16010];
int num_yoko ,num_tate;
vector<int> YOKO,TATE;

bool recursive(bool is_yoko,int loc,int moved_count){

	if(dp[moved_count][loc+NUM] != -1){

		return dp[moved_count][loc+NUM] == 1; //★★メモる時はNUMを足す
	}
	if(is_yoko){

		if(moved_count == num_yoko){

			return loc == ans_x;
		}

	}else{

		if(moved_count == num_tate){

			return loc == ans_y;
		}
	}

	bool ret = false;
	int diff;

	if(is_yoko){

		diff = YOKO[moved_count];

	}else{

		diff = TATE[moved_count];
	}


	ret = recursive(is_yoko,loc+diff,moved_count+1) || recursive(is_yoko,loc-diff,moved_count+1);

	if(ret){

		dp[moved_count][loc+NUM] = 1;

	}else{

		dp[moved_count][loc+NUM] = 0;
	}

	return ret;
}


int main(){

	bool is_yoko = true;

	scanf("%s",buf);
	scanf("%d %d",&ans_x,&ans_y);

	int tmp;
	num_yoko = 0,num_tate = 0;
	bool is_First = true;
	int start_x = 0;

	//文字列を、移動距離の集団に分解し、かつそれを上下に分ける[★縦の動きと横の動きを、それぞれ別に考える★]
	for(int i = 0; buf[i] != '\0'; ){

		if(buf[i] == 'T'){

			if(is_First){ //いきなり向き変換

				is_First = false;
			}

			if(is_yoko){
				is_yoko = false;
			}else{
				is_yoko = true;
			}

			i += 1;

		}else{

			tmp = 0;
			for(;buf[i+tmp] != '\0' && buf[i+tmp] == 'F'; tmp++);

			if(is_First){ //向き強制

				start_x = tmp;
				is_First = false;
				i += tmp;
				continue;
			}

			if(is_yoko){

				num_yoko++;
				YOKO.push_back(tmp);

			}else{

				num_tate++;
				TATE.push_back(tmp);
			}

			i += tmp;
		}
	}

	//まず、左右について調べる
	for(int i = 0; i <= num_yoko; i++){
		for(int k = 0; k <= 2*NUM; k++){

			dp[i][k] = -1;
		}
	}

	if(!recursive(true,start_x,0)){

		printf("No\n");
		return 0;
	}

	//続いて上下について調べる
	for(int i = 0; i <= num_tate; i++){
		for(int k = 0; k <= 2*NUM; k++){

			dp[i][k] = -1;
		}
	}

	if(!recursive(false,0,0)){

		printf("No\n");
		return 0;
	}

	printf("Yes\n");

	return 0;
}


Measured memory_bytes: 84352
#include <stdio.h>

int main()
{
  char a[1001];
  int i, c=0, n;

  scanf("%s", a);
  scanf("%d", &n);

  while(1){
    if(a[c]=='\0')break;
    c++;
  }
  for(i=0; i<c; i+=n){
    printf("%c", a[i]);
  }
  return 0;
}


Measured memory_bytes: 128
#include<sstream>
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <cstdlib> 
#include <iomanip> 
#include<numeric>
#include<set>
#include<bitset>
#include<cstring>
#include<stack>
#include<queue>
#include<list>
#include<map>
#include<vector>
#include<ctype.h>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <vector>
using namespace std;
int arr[200];
int main() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, x;
	cin >> n >> x;
	vector<string> s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++) {
		cout << s[i];
	}
	cout << endl;

	system("pause");
	//return 0;

}


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string N){
    long long ans = 0;
    for(int i=0;i<N.size();i++){
        ans+=N[i]-'0';
    }
    if(ans%9==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string N;
    std::cin >> N;
    solve(N);
    return 0;
}


Measured memory_bytes: 3824