akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n;cin>>n;
	vector<ll> a(n);
	vector<ll> b(n);
	vector<ll> c(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	for(int i = 0; i < n; i++) {
		cin>>b[i];
	}
	for(int i = 0; i < n; i++) {
		cin>>c[i];
	}

	sort(ALL(a));
	sort(ALL(b));
	sort(ALL(c));
	ll ans = 0LL;
	for(int i = 0; i < n; i++) {
		ll id1 = lower_bound(ALL(a),b[i]) - a.begin();
		// cout << id1 << endl;
		ll id2 = c.end() - upper_bound(ALL(c),b[i]);
		ans += id1 * id2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<n;i++)
#define REP1(i,n) for(long long i=1;i<=n;i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();ite++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
typedef long long ll;
typedef pair<int,int> pii;
//---------------------
#define MAXN 10
//---------------------
ll n,m,k[MAXN],s[10][10],p[MAXN];
ll curl;
bool isOK(ll bid){
	ll ct=0;
	//cout<<curl<<" "<<bid<<endl;
	REP(i,k[bid]){
		if((curl>>(s[bid][i]-1))&1) ct++;
	}
	return ct%2==p[bid];
}

int main(){
	cin>>n>>m;
	REP(i,m){
		cin>>k[i];
		REP(j,k[i]){
			cin>>s[i][j];
		}
	}
	REP(i,m) cin>>p[i];
	ll res=0;
	for(curl=0;curl<(1<<n);curl++){
		bool flag=true;
		REP(i,m){
			if(!isOK(i)){
				flag=false;
				break;
			}
		}
		if(flag) res++;
	}
	cout<<res<<endl;
    return 0;

}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int nn = sc.nextInt();
		String ss = sc.next();
		
		if(nn%2==1) {
			System.out.print("No");
			return;
		}
		for (int i=0;i*2<nn;i++){
			if(ss.charAt(i) != ss.charAt(nn/2+i)) {
				System.out.print("No");
				return;
			}
		}
		
		System.out.print("Yes");
		
		
	}
}

Measured memory_bytes: 23764
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> P;
lli MOD = 1000000007;
int main()
{
    int w, h;
    string s;
    cin >> h >> w;
    rep(i, h) rep(j, w)
    {
        cin >> s;
        if (s == "snuke")
            cout << char(j + 'A') << i + 1 << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <ios>
#include <utility>
#include <vector>

using namespace std;

struct Card
{
    char suit;
    int value;    
};


int partition(Card A[], int p, int r){
    int x = A[r].value;
    int i = p - 1;
    for (int j = p; j != r; ++j){
        if (A[j].value <= x) swap(A[++i], A[j]);
    }
    swap(A[i + 1], A[r]);
    return i + 1;
}

void quicksort(Card A[], int p, int r){
    if (p < r){
        int q = partition(A, p, r);
        quicksort(A, p, q - 1);
        quicksort(A, q + 1, r);
    }
}

const int SENTINEL = 1000000005;

void merge(vector<Card> & A, int left, int mid, int right){
    auto n1 = mid - left;
    auto n2 = right - mid;
    vector<Card> L(n1);
    vector<Card> R(n2);
    copy(A.begin() + left, A.begin() + mid  , L.begin());
    copy(A.begin() + mid , A.begin() + right, R.begin());
    L.push_back(Card{'A', SENTINEL});
    R.push_back(Card{'A', SENTINEL});
    auto itL = L.begin();
    auto itR = R.begin();
    for (auto itA = A.begin() + left; itA != A.begin() + right; ++itA){
        if (itL->value <= itR->value){
            *itA = *itL;
            ++itL;
        }else{
            *itA = *itR;
            ++itR;
        }
    }
}

void merge_sort(vector<Card> & A, int left, int right){
    if (left + 1 < right){
        auto mid = (left + right) / 2;
        merge_sort(A, left, mid);
        merge_sort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main()
{
    ios::sync_with_stdio(false);
    int n = 0;
    cin >> n;
    Card A[100000] = {};
    vector<Card> B;
    for (int i = 0; i != n; ++i){
        cin >> A[i].suit >> A[i].value;
        B.push_back(A[i]);
    }
    quicksort(A, 0, n - 1);
    merge_sort(B, 0, n);
    bool is_stable = true;
    for (int i = 0; i != n; ++i){
        if (A[i].suit != B[i].suit){
            is_stable = false;
            break;
        }
    }
    if (is_stable){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }
    for (int i = 0; i != n; ++i) cout << A[i].suit << ' ' << A[i].value << endl;
    return 0;
}

Measured memory_bytes: 6040
#include<iostream>
#include<vector>
#include<tuple>
#include<algorithm>
#include<string>
using namespace std ;

void swap(int &a,int &b){
	int c = a ; a = b ; b = c ;
}

int main(){
	int n,m ;
	cin >> n >> m ;
	vector<tuple<int,int,int>> vec(m) ;
	for(int i=0;i<m;i++){
		int a,b ;
		cin >> a >> b ;
		get<0>(vec.at(i)) = a ;
		get<1>(vec.at(i)) = b ;
		get<2>(vec.at(i)) = i ;
	}
	sort(vec.begin(),vec.end()) ;
	int ken = 1 ;
	int ban = 1 ;
	for(int i=0;i<m;i++){
		if(get<0>(vec.at(i))==ken){
			get<1>(vec.at(i)) = ban ;
			ban++ ;
			swap(get<0>(vec.at(i)),get<2>(vec.at(i))) ;
		}else{
			ban = 2 ;
			ken = get<0>(vec.at(i)) ;
			get<1>(vec.at(i)) = 1 ;
			swap(get<0>(vec.at(i)),get<2>(vec.at(i))) ;
		}
	}
	sort(vec.begin(),vec.end()) ;
	for(int i=0;i<m;i++){
		string s = to_string(get<2>(vec.at(i))) ;
		for(int j=0;j<6-s.size();j++) cout << 0 ;
		cout << s ;
		s = to_string(get<1>(vec.at(i))) ;
		for(int j=0;j<6-s.size();j++) cout << 0 ;
		cout << s << endl ;
	}
}

Measured memory_bytes: 2688
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int A, B;
    cin >> A >> B;
    cout << (B % A == 0 ? A + B : B - A) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int H, W;
bool S[21][21];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> H >> W;
  int cnt = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      char c;
      cin >> c;
      if (c == '.') {
        S[i][j] = true;
        cnt++;
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j]) {
        vector<vector<int>> dist(21, vector<int>(21, INF));
        dist[i][j] = 0;
        queue<pair<int, int>> q;
        q.emplace(i, j);
        while (!q.empty()) {
          int h, w;
          tie(h, w) = q.front();
          q.pop();
          if (w > 0 && S[h][w - 1] && dist[h][w - 1] == INF) {
            q.emplace(h, w - 1);
            dist[h][w - 1] = dist[h][w] + 1;
            ans = max(ans, dist[h][w - 1]);
          }
          if (w < W - 1 && S[h][w + 1] && dist[h][w + 1] == INF) {
            q.emplace(h, w + 1);
            dist[h][w + 1] = dist[h][w] + 1;
            ans = max(ans, dist[h][w + 1]);
          }
          if (h > 0 && S[h - 1][w] && dist[h - 1][w] == INF) {
            q.emplace(h - 1, w);
            dist[h - 1][w] = dist[h][w] + 1;
            ans = max(ans, dist[h - 1][w]);
          }
          if (h < H - 1 && S[h + 1][w] && dist[h + 1][w] == INF) {
            q.emplace(h + 1, w);
            dist[h + 1][w] = dist[h][w] + 1;
            ans = max(ans, dist[h + 1][w]);
          }
        }
      }
    }
  }

  cout << ans << endl;
  return 0;
}


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

int main(){
    LL N;
    cin >> N;
    LL ans = 0;
    for(LL i = 1;i*i < N;i++){
        if(N%i == 0){
            LL m = N/i-1;
            LL p = i;
            if(m > p) ans += m;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long LL;
typedef unsigned int UI;

#define rSort(a) 		sort(a.rbegin(),a.rend())
#define Sort(a) 		sort(a.begin(),a.end())
#define Reverse(a) 		reverse(a.begin(),a.end())
#define Sum(a)  		accumulate(a.begin(), a.end(), 0)
#define REP(i, n) 		for(UI i = 0;i < n;i++)
#define REPR(i, n) 		for(UI i = n;i >= 0;i--)
#define FOR(i, m, n) 	for(UI i = m;i < n;i++)
#define pb(i) 			push_back(i)

#define MOD  			(LL)1e9 + 7;
#define INF  			(LL)1 << 62;

int main(int argc, const char * argv[]) {

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

	LL N,M;
    LL sum = 0;

	cin >> N >> M;

	vector< pair<LL, LL> > AB(N);

	REP(i,N){
		cin >> AB[i].first >> AB[i].second;
	}

	Sort(AB);   //first がキー


	REP(i,N){
		while(M > 0 && AB[i].second > 0){
			M--;
			AB[i].second--;
			sum += AB[i].first;
		}
		if(M==0) break;
	}

    cout << sum << endl;

	return 0;

}

Measured memory_bytes: 1792
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var output = "";
  for(var i = 0; i < N; i++){
    output += "ACL";
  }
  myout(output);
}


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

using namespace std;

typedef long long ll;

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

	string s;
	cin >> s;

	int n = s.size();

	rep(i, n) cout << "x";
	cout << endl;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int num;
    cin>>num;
    int temp=num;
    int ans=0;
    while(num!=0){
        ans+=num%10;
        num/=10;
    }
    if(temp%ans==0) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long N, long long A, long long B){
    if((B-A) % 2 == 1)
        cout << "Borys" <<endl;
    else
        cout<< "Alice"<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(N, A, B);
    return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
 
template <typename T>
void cetak(T t){cout << t << ')' << endl;}
template <typename T, typename... V>
void cetak(T t, V... v) {cout << t; if (sizeof...(v)) cout << ", "; cetak(v...);}
 
#define debug(x...) cout << '(' << #x << ") = ("; cetak(x) 
#define sz(x) (int)(x.size())
#define lt(x) (int)(x.length())


const int MOD = 1e9 + 7;

int add(int x, int y){
    int ret = x + y;
    if(ret >= MOD) ret -= MOD;
    return ret;
}
int sub(int x, int y){
    int ret = x - y;
    if(ret < 0) ret += MOD;
    return ret;
}
int mul(int x, int y){
    return (long long)x * y % MOD;
}


const int mx = 1e5 + 10;
vector<int> a;
vector<long long> pref;

pair<long long, long long> solve(int batas){
    int n = sz(a);
    int sampai = -1;
    long long tot = 0, count = 0;
    for(int i = n - 1; i >= 0; i--){
        while(sampai + 1 < n && a[sampai + 1] + a[i] >= batas) sampai += 1;
        count += sampai + 1;
        if(sampai >= 0) tot += pref[sampai];
        tot += 1LL * a[i] * (sampai + 1);
    }
    return {tot, count};
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    long long m;
    cin >> n >> m;
    a.resize(n);
    pref.resize(n);
    for(int &i : a) cin >> i;
    sort(ALL(a));
    reverse(ALL(a));
    for(int i = 0; i < n; i++){
        if(i == 0) pref[i] = a[i];
        else pref[i] = pref[i - 1] + a[i];
    }
    int lo = 0, hi = 2e5, mid, di;
    while(lo <= hi){
        mid = (lo + hi) >> 1;
        auto aa = solve(mid);
        if(aa.s >= m){
            lo = mid + 1;
            di = mid;
        }
        else hi = mid - 1;
    }
    auto aa = solve(di);
    cout << aa.f - di * (aa.s - m) << endl;
}

Measured memory_bytes: 1536
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	LL n;
    cin>>n;
    n--;
    string ans="";
    LL t=0,tt=26;
    while(1){
        ans+="a";
        if(t+tt<=n){
            t+=tt;
            tt*=26;
        }else{
            n-=t;
            break;
        }
    }
    cerr<<ans.length();
    int idx=0;
    while(1){
        ans[idx]+=(n%26);
        idx++;
        n/=26;
        if(idx==ans.length())break;
    }
    int ln=ans.length();
    FORD(i,ln,0){
        cout<<ans[i];
    }
    cout<<endl;
}


Measured memory_bytes: 3628
N = int(input())
X = [int(x) for x in input().split()]

XX = list(tuple(X))
XX.sort()
X_medium_1 = XX[(N//2)-1]
X_medium_2 = XX[N//2]

for n in range(N):
  if X[n] <= X_medium_1:
    print(X_medium_2)
  else: # X[n] >= X_medium_2:
    print(X_medium_1)

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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

int main() {
    lli n, d;
    cin >> n >> d;
    lli x[n][d];
    REP(i, 0, n) {
        REP(j, 0, d) {
            cin >> x[i][j];
        }
    }
    lli ans = 0;
    REP(i, 0, n) {
        REP(j, i+1, n) {
            lli di = 0;
            // i と j の距離
            REP(k, 0, d) {
                di += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            lli ds = (int)sqrt(di);
            //cout << "d:i " << di << endl;
            //cout << "ds: " << ds << endl;
            if (di == ds*ds)
                ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <functional>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)

#define huge 1000000007
typedef long long ll;
ll gcd(ll a, ll b);

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll D = 0;
	ll M = 0;
	//ll M = 0;
	//ll a[200] = {};
	//ll b[200] = {};
	//ll v[3] = {};
	ll *c, *s, *n;
	string S,T,U[52];
	ll count = 0;
	ll count2 = 0;
	ll sum = 0;
	ll min = 100000;
	ll max = 0;
	ll smax = 0;
	ll max2 = 0;
	ll smax2 = 0;
	int tmax = 0;
	int tmax2 = 0;
	int flag = 0;
	char temp,head;
	//int is = 0;
	
	
	//char p;


	

	

	//cin >> S;
	
	//b = (ll *)malloc(M * sizeof(ll));
	//vector<pair<int,int>> ch(50);

	
	cin >> N;

	c = (ll *)malloc((N-1) * sizeof(ll));
	s = (ll *)malloc((N - 1) * sizeof(ll));
	n = (ll *)malloc((N - 1) * sizeof(ll));

	rep(i, 0, N - 1) {
		cin >> c[i] >> s[i] >> n[i];
	}

	rep(j, 0, N - 1) {

		//cout << j << endl;

		sum += s[j];
		sum += c[j];

		rep(i,j+1,N-1) {

			if (sum < s[i]) {
				sum = s[i];
				sum += c[i];
			}
			else if(sum % n[i] != 0){
				sum = sum + n[i] - (sum % n[i]);
				sum += c[i];
			}
			else {
				sum += c[i];
			}

			//cout << sum << endl;
		}

		cout << sum << endl;
		sum = 0;

	}

	cout << 0 << endl;
	//x = (ll *)malloc((N+1) * sizeof(ll));
	//c = (ll *)malloc((N) * sizeof(ll));
	//cin >> D >> G;
	//vector<pair<int,int>> tr(M);
	//vector<pair<int,int>> qes(Q);
	//sort(c.begin(), c.end());
	
	//cout << c[2] - c[1] << endl;

	

	/*A = N / 1000;
	N %= 1000;
	B = N / 100;
	N %= 100;
	C = N / 10;
	N %= 10;
	D = N;*/
	


	return 0;

}

ll gcd(ll a, ll b) {
	ll x = a * b;

	/* 自然数 a > b を確認・入替 */
	if (a<b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}


	return x/b;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <climits>
#include <math.h>
#include <utility>
#include <ctime>
#include <cstdlib>
using namespace std;

typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main() {
	int a, b; cin >> a >> b;
	if (a == 1)a += 13;
	if (b == 1)b += 13;
	if (a > b) {
		cout << "Alice" << endl;
	}
	else if (b > a) {
		cout << "Bob" << endl;
	}
	else {
		cout << "Draw" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        String word = null;
        int[] cnt = new int[26];
        for (int i = 0; i < cnt.length; i++ )
            cnt[i] = 0;
        while(input.hasNext()){
            word = input.nextLine();
            char[] words = word.toCharArray();
            store(words, cnt);
        }
        for(int j = 0; j < cnt.length; j ++){
            System.out.println((char)('a' + j) + " : " + cnt[j]);
        }
    }
    
    public static void store(char[] w, int[] c){
        int temp = 0;
        for(int i = 0; i < w.length; i ++){
            if(w[i] <= 'z' && w[i] >= 'a'){
                temp = w[i] - 'a';
                c[temp] ++;
            }
            else if(w[i] <= 'Z' && w[i] >= 'A'){
                temp = w[i] - 'A';
                c[temp] ++;
            }
        }
    }
}


Measured memory_bytes: 26120
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <bitset>

using namespace std;
using ll = long long;

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

ll f[N], fr[N];

ll binpow(ll a, int p) {
    ll res = 1;
    while (p) {
        if (p & 1) {
            (res *= a) %= MOD;
        }
        (a *= a) %= MOD;
        p >>= 1;
    }
    return res;
}

ll cnk(int n, int k) {
    return f[n] * fr[n - k] % MOD * fr[k] % MOD;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    f[0] = fr[0] = 1;
    for (int i = 1; i < N; i++) {
        f[i] = f[i - 1] * i % MOD;
        fr[i] = binpow(f[i], MOD - 2);
    }

    int n;
    ll a, b, c;
    cin >> n >> a >> b >> c;
    ll q = binpow(100, MOD - 2);
    a = a * q % MOD;
    b = b * q % MOD;
    c = c * q % MOD;
    ll ans = 0;

    for (int i = n; i <= 2 * n - 1; i++) {
        ll len = i * binpow(1 - c + MOD, 1LL * (MOD - 2) * i % (MOD - 1)) % MOD;
        len = len * binpow(c - 1, MOD - 2) % MOD;
        len = MOD - len;
        ll d = len * cnk(i - 1, n - 1) % MOD;
        d = d * binpow(a, n) % MOD * binpow(b, i - n) % MOD;
        ans = (ans + d) % MOD;
        d = len * cnk(i - 1, n - 1) % MOD;
        d = d * binpow(b, n) % MOD * binpow(a, i - n) % MOD;
        ans = (ans + d) % MOD;
    }

    cout << ans << endl;
    return 0;
}

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

char map[20][20];

int W, H, start_x, start_y, ans = 0;

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

void dfs(int x, int y)
{
  ans++;
  if(map[x][y] != '#'){
    map[x][y] = '#';
    for(int i = 0; i < 4; i++){
      int next_x = x + dx[i], next_y = y + dy[i];
      if(next_x < W && next_x >= 0 && next_y < H && next_y >= 0){
	if(map[next_x][next_y] == '#')
	  continue;
	dfs(next_x, next_y);
      }else{
	continue;
      }
    }
  }
}

int main()
{
  while(1){
    cin >> W >> H;
    if(W == 0 && H == 0){
      break;
    }else{
      for(int i = 0; i < H; i++){
	for(int j = 0; j < W; j++){
	  cin >> map[j][i];
	  if(map[j][i] == '@'){
	    start_x = j;
	    start_y = i;
	  }
	}
      }
      dfs(start_x, start_y);
      cout << ans << endl;
      ans = 0;
    }
  }
}

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

int main()
{
    int n; cin >> n;
    string tmp;
    set<string> s;
    rep(i,n) {
        cin >> tmp;
        s.insert(tmp);
    }

    cout << s.size() << endl;
}



Measured memory_bytes: 19152
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n, k, s; cin >> n >> k >> s;
	REP(i, n) {
		if (i < k) {
			cout << s << ' ';
		}
		else if (s != 1000000000) {
			cout << s + 1 << ' ';
		}
		else {
			cout << 1 << ' ';
		}
	}
}

Measured memory_bytes: 1280
#include <iostream>
    #include <string>
    #include <math.h>
    #include<algorithm>
    using namespace std;
     
    int main(){
      int x1,x2,y1,y2;
      cin >> x1 >> y1 >> x2 >> y2;
       cout << x2+y1-y2 << ' ' << y2-x1+x2 << ' ' << x1+y1-y2 << ' ' << y1-x1+x2 << endl; 
      return 0;}

Measured memory_bytes: 256
n = int(input())
ans = []
t,a = map(int,input().split())
h = list(map(int,input().split()))
ans = 100000
for i in range(n):
    if abs(t - h[i]*0.006 - a) < ans:
        num = i+1
        ans = abs(t - h[i]*0.006 - a)
print(num)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  vi h(n);
  int maxi = 0;
  rep(i,n){
    cin >> h.at(i);
    maxi = max(maxi,h.at(i));
  }
  int ans = 0;
  rep(i,maxi){
    bool flag = false;
    rep(j,n){
      if(h.at(j) > 0){
        h.at(j)--;
        flag = true;
      }else if(flag){
        flag = false;
        ans++;
      }
    }
    if(flag) ans++;
  }
  cout << ans << endl;
}


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

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

  if (B - A <= 0) {
    cout << "delicious" << endl;
  }
  else if (B - A <= X) {
    cout << "safe" << endl;
  }
  else {
    cout << "dangerous" << endl;
  }
}

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

struct Point {double x,y;};

void K(int n,Point a,Point b){
  if(n==0)return;
  Point s,t,u;
  double th=M_PI*60.0/180.0;
  s.x=(2.0*a.x+1.0*b.x)/3.0;
  s.y=(2.0*a.y+1.0*b.y)/3.0;
  t.x=(1.0*a.x+2.0*b.x)/3.0;
  t.y=(1.0*a.y+2.0*b.y)/3.0;
  u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
  u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
  K(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  K(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  K(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  K(n-1,t,b);
}

int main(){
  Point a,b;
  int n;
  scanf("%d",&n);
  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;
  printf("%.8f %.8f\n",a.x,a.y);
  K(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
  return 0;
}



Measured memory_bytes: 2676
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << "\n"; }
#define dbm(map) cerr << #map << ":"; for (auto p : map) cerr << "(" << p.first << ", " << p.second << "), "; cerr << "\n";
#define YN(f) cout << (f ? "YES" : "NO") << "\n"
#define Yn(f) cout << (f ? "Yes" : "No") << "\n"
#define yn(f) cout << (f ? "yes" : "no") << "\n"
using ll = long long;
using vi = vector<int>; using vl = vector<ll>; using vs = vector<string>; using vb = vector<bool>;
using vvi = vector<vi>; using vvl = vector<vl>; using vvb = vector<vb>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using vpii = vector<pii>; using vpll = vector<pll>;
using ti3 = tuple<int, int, int>; using tl3 = tuple<ll, ll, ll>;
using mii = map<int, int>; using mil = map<int, ll>; using mli = map<ll, int>; using mll = map<ll, ll>;

int main() {
	int n; cin >> n;
	vvi g(n + 1); vi d(n + 1, -1); // 1-ind
	rep2(i, 1, n + 1) {
		int _, k; cin >> _ >> k;
		rep(j, k) {
			int v; cin >> v;
			g[i].push_back(v);
		}
	}
	// dbvv(g);
	queue<int> q;
	q.push(1); d[1] = 0;
	while (!q.empty()) {
		int u = q.front(); q.pop();
		for (int v : g[u]) {
			if (d[v] != -1) continue;
			d[v] = d[u] + 1;
			q.push(v);
		}
	}
	rep2(i, 1, n + 1) printf("%d %d\n", i, d[i]);
}


Measured memory_bytes: 3212
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int V, E;
vector<int> G[10005], revG[10005];
vector<int> topo;
bool used[10005];
int scc[10005];

void tpsort(int v)
{
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(!used[G[v][i]]) tpsort(G[v][i]);
	}
	topo.push_back(v);
}
void sccdfs(int v, int id)
{
	used[v] = true;
	scc[v] = id;
	for(int i = 0; i < revG[v].size(); i++){
		if(!used[revG[v][i]]) sccdfs(revG[v][i], id);
	}
}

int main(void)
{
	cin >> V >> E;
	int u, v;
	for(int i = 1; i <= E; i++){
		cin >> u >> v;
		u++, v++;
		G[u].push_back(v);
		revG[v].push_back(u);
	}
	
	for(int i = 1; i <= V; i++) if(!used[i]) tpsort(i);
	reverse(topo.begin(), topo.end());
	
	int id = 0;
	for(int i = 1; i <= V; i++) used[i] = false;
	for(int i = 0; i < topo.size(); i++) if(!used[topo[i]]) sccdfs(topo[i], id++);
	
	int Q;
	cin >> Q;
	for(int q = 0; q < Q; q++){
		cin >> u >> v;
		u++, v++;
		cout << (scc[u] == scc[v]) << endl;
	}
	
	return 0;
}


Measured memory_bytes: 4676
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

ll R, S, P;

ll getP(char c){
    if (c == 'r') return P;
    if (c == 's') return R;
    return S;
}

int main() {

    ll N, K;
    string T;
    cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;

    vector<ll> val(N, 0);
    ll ans = 0;
    REP(i, N){
        if (i < K){
            ans += getP(T[i]);
            val[i] = getP(T[i]);
        }
        else if(val[i - K] == 0 || T[i - K] != T[i]){
            ans += getP(T[i]);
            val[i] = getP(T[i]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    while(s.size()!=0){
        int l=s.size();
        if(s.size()>=5){
        if(s.substr(s.size()-5)=="erase"||s.substr(s.size()-5)=="dream"){
            s.erase(s.size()-5);
        }
        }
        if(s.size()>=6){
        if(s.substr(s.size()-6)=="eraser"){
            s.erase(s.size()-6);
        }
        }
        if(s.size()>=7){
        if(s.substr(s.size()-7)=="dreamer"){
            s.erase(s.size()-7);
        }
        }
        if(s.size()==l){
        NO;return 0;
        }
    }
    YES;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
 
int main()
{
 
 
int k;cin>>k; 
 string a;
 cin>>a;
 if(a.length()>k)
 {
    for(int  i=0;i<k;i++)
    {
        cout<<a[i];
    }
    cout<<"...";
 }else
 {
     cout<<a;
 }
 

 
return 0;
   
}

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

int main() {

int a,b,c ;
cin>>a>>b ;
for (int i=1;i<=3;i++)
{
    if((i*a*b)%2==1)
    {
        c=1 ;
    }
    else {c=0;}
}

if(c==1){cout<<"Yes";}
else {cout<<"No" ;}
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		long sum=0;
		long w_ks=0;
		for(int i=0; i<s.length(); i++) {
			if(s.charAt(i)=='W') {
				sum+=i;
				w_ks++;
			}
		}
		System.out.println(sum-w_ks*(w_ks-1)/2);
	}
}

Measured memory_bytes: 27860
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;

map< ll , ll > f;
ll n,k,a,sum,myAns,var,ultimo,b[200010];

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    f[ 0 ] = 1;
    b[ 0 ] = 0;

    cin >> n >> k;
    for(ll i=1; i<=n; i++){
        cin >> a;

        if( i-ultimo==k ){
            f[ b[ultimo] ]--;
            ultimo++;
        }

        sum=(sum+a)%k;
        sum-=(i%k);
        if( sum < 0 ) sum+=k;

        if( f.find( (k-sum)%k )!=f.end() ) myAns+=f[ (k-sum)%k ];

        sum=(sum+i)%k;

        var = i%k;
        var-=sum;
        if( var < 0 ) var+=k;
        f[ var ]++;
        b[ i ] = var;


    }

    cout << myAns;

    return 0;
}


Measured memory_bytes: 14336
#include <stdio.h>
int main(void)
{
    int i, j;
    int H, W;

    do{
        scanf("%d %d", &H, &W); 
        if(H == 0 && W == 0) break;
        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++){
                printf("#");
            }
            putchar('\n');
        }
        putchar('\n');
    } while((H != 0) || (W != 0));

    
    return 0;
}


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

int main(){
  long long n,k;
  cin>>n>>k;
  long long a=n%k,b=n%k-k;
  if(b>=0) b=n%k-k;
  else b=k-n%k;
  cout<<min(a,b)<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef unsigned int uint;
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

const int MX = 100005;

ll D[MX], V[MX];
ll A[2][MX], B[2][MX];

int main()
{
	ll N, C;
	scanf("%lld%lld", &N, &C);

	ll ans = 0;
	for(int i = 1; i <= N; i++) scanf("%lld%lld", D+i, V+i);
	for(int t = 0; t < 2; t++){
		for(int i = 1; i <= N; i++) A[t][i] = A[t][i-1] + V[i] - (D[i] - D[i-1]);
		for(int i = 1; i <= N; i++) A[t][i] = max(A[t][i-1], A[t][i]);
		for(int i = 1; i <= N; i++) B[t][i] = B[t][i-1] + V[i] - 2*(D[i] - D[i-1]);

		for(int i = 1; i <= N; i++) D[i] = C - D[i];
		reverse(D+1, D+N+1);
		reverse(V+1, V+N+1);
	}
	for(int i = 0; i <= N; i++){
		ans = max(ans, A[0][i] + B[1][N-i]);
		ans = max(ans, A[1][i] + B[0][N-i]);
	}
	printf("%lld\n", ans);
}


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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(typeof((v).begin()) it = (v).begin(); it != (v).end(); ++it)
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

int T[1000005];

int main(){
	int N, C, K;
	scanf("%d%d%d", &N, &C, &K);
	rep(i,0,N)
		scanf("%d", T+i);
	sort(T, T+N);
	int ans=0;
	int t = 0;
	int s = 0;
	rep(i,0,N){
		if(T[i] <= t && s){
			--s;
			continue;
		}
		t = T[i]+K;
		s = C-1;
		++ans;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
n=int(input())
h=list(map(int,input().split()))
cost=[0]*n
cost[-2]=abs(h[-1]-h[-2])
for i in range(n-3,-1,-1):
  cost[i]=min(abs(h[i]-h[i+1])+cost[i+1],abs(h[i]-h[i+2])+cost[i+2])
print(cost[0])

Measured memory_bytes: 84944
#include <bits/stdc++.h>
using namespace std;
int main(){
	int count=0;
	string S,T;
	 cin>>S; cin>>T;
	 for(int i=0;i<3;i++){
		 if(S.at(i)==T.at(i)){
			 count+=1;
		 }
	 }
	 cout<<count<<endl;
}

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

int main(){
  int n,y;
  cin >> n >> y;
  
  int res10000 = -1, res5000 = -1, res1000 = -1;
  
  for (int i=0; i<=n; i++){
    for (int j=0; j<=n-i; j++){
      int k = n - i - j;
      int sum = 10000*i + 5000*j + 1000*k;
      
      if (sum == y){
        res10000 = i;
        res5000 = j;
        res1000 = k;
        break;
      }
      
    }
  }
  
  cout << res10000 << ' ' << res5000 << ' ' << res1000 << endl;
}

Measured memory_bytes: 256
import math
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def ncr(n, r, mod=None):
    """
    scipy.misc.comb または scipy.special.comb と同じ
    組み合わせの数 nCr
    :param int n:
    :param int r:
    :param int mod: 3 以上の素数であること
    :rtype: int
    """
    assert n >= r

    def inv(a):
        """
        a の逆元
        :param a:
        :return:
        """
        return pow(a, mod - 2, mod)

    if mod:
        return math.factorial(n) * inv(math.factorial(r)) * inv(math.factorial(n - r)) % mod
    else:
        return math.factorial(n) // math.factorial(r) // math.factorial(n - r)


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


def pyramid(n):
    return n * (n + 1) * (n + 2) // 6


MOD = 10 ** 9 + 7

# K == 2 の場合
k2 = (pyramid(N - 1) * M ** 2 + pyramid(M - 1) * N ** 2) % MOD
# k2 を何回使うか
c = ncr(N * M - 2, K - 2, mod=MOD)
print(k2 * c % MOD)


Measured memory_bytes: 5832
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        sc.close();

        int[] a = new int[26];
        for(int i = 0; i < s.length(); i++){
            a[(int)(s.charAt(i) - 'a')]++;
        }

        for(int i = 0; i < 26; i++){
            if(a[i] == 0){
                System.out.println((char)('a'+i));
                return;
            }
        }
        System.out.println("None");
    }
}

Measured memory_bytes: 23636
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
import numpy as np
# from numpy import cumsum  # accumulate
from pprint import pprint

def grid_wall(grid, h, w, wall='#'):
    G = [[wall]*(w+2) for _ in range(h+2)]
    for hi in range(h):
        G[hi+1][1:w+1] = grid[hi]
    return G

def solve():
    H, W = MI()
    G = LLS(H)

    black_cnt = 0
    for i in range(H):
        for j in range(W):
            if G[i][j] == '#':
                black_cnt += 1
    # print(black_cnt)

    G[-1][-1] = 'G'
    G[0][0] = '#'

    G2 = grid_wall(G, H, W, '#')
    # print(np.array(G2))

    q = deque([(1, 1, 1)])
    move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
    cost = INF
    while q:
        x, y, d = q.popleft()
        for dx, dy in move:
            nx, ny = x+dx, y+dy
            if G2[nx][ny] == 'G':
                cost = min(cost, d + 1)
            elif G2[nx][ny] == '#': continue
            else:
                q.append((nx, ny, d+1))
                G2[nx][ny] = '#'
    if cost == INF:
        print(-1)
        return
    # print(cost)
    print(H * W - black_cnt - cost)
if __name__ == '__main__':
    solve()


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

namespace AOJ0071
{
    class Program
    {
        static void Main()
        {
            var count = 1;
            foreach (var dataSet in ReadInputs())
            {
                Console.WriteLine("Data {0}:", count);
                var field = ProcessChain(dataSet);

                for (var l = 0; l < 8; l++)
                {
                    for (var c = 0; c < 8; c++)
                    {
                        Console.Write(field[l,c] ? '1' : '0');
                    }
                    Console.WriteLine();
                }

                count++;
            }
        }

        private static bool[,] ProcessChain(DataSet dataSet)
        {
            var queue = new Queue<Point>();
            queue.Enqueue(dataSet.FirstBomb);

            while (queue.Any())
            {
                var point = queue.Dequeue();
                dataSet.Field[point.Y, point.X] = false;

                for (var d = -3; d <= 3; d++)
                {
                    if (point.X + d >= 0 && point.X + d < 8 && dataSet.Field[point.Y, point.X + d])
                    {
                        queue.Enqueue(new Point(point.X + d, point.Y));
                    }

                    if (point.Y + d >= 0 && point.Y + d < 8 && dataSet.Field[point.Y + d, point.X])
                    {
                        queue.Enqueue(new Point(point.X, point.Y + d));
                    }
                }
            }

            return dataSet.Field;
        }

        public static IEnumerable<DataSet> ReadInputs()
        {
            var count = int.Parse(Console.ReadLine() ?? "");
            for (var i = 0; i < count; i++)
            {
                Console.ReadLine();

                var field = new bool[8,8];
                for (var l = 0; l < 8; l++)
                {
                    var line = (Console.ReadLine() ?? "").ToCharArray();
                    for (var c = 0; c < 8; c++)
                    {
                        field[l, c] = line[c] == '1';
                    }
                }
                var x = int.Parse(Console.ReadLine() ?? "") - 1;
                var y = int.Parse(Console.ReadLine() ?? "") - 1;

                yield return new DataSet(field, new Point(x, y));
            }
        }
    }

    class DataSet
    {
        public Point FirstBomb { get; private set; }
        public bool[,] Field { get; set; }

        public DataSet(bool[,] field, Point firstBomb)
        {
            Field = field;
            FirstBomb = firstBomb;
        }
    }

    class Point
    {
        public int X { get; private set; }
        public int Y { get; private set; }

        public Point(int x, int y)
        {
            X = x;
            Y = y;
        }
    }
}

Measured memory_bytes: 6256