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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;

    ll dp[105][4][4][4];
    ll A = 0, C = 1, G = 2, T = 3;

    REP(i, 105){
    	REP(j, 4){
    		REP(k, 4){
    			REP(l, 4){
    				dp[i][j][k][l] = 0;
    			}
    		}
    	}
    }

    REP(j, 4){
		REP(k, 4){
			REP(l, 4){
				dp[3][j][k][l] = 1;
			}
		}
	}

    for(int i=3;i<N;i++){
    	REP(j, 4){
    		REP(k, 4){
    			REP(l, 4){
    				if(j == A && k == G && l == C) continue;
    				if(j == A && k == C && l == G) continue;
    				if(j == G && k == A && l == C) continue;
    				REP(m, 4){
    					if(j == A && l == G && m == C) continue;
    					if(j == A && k == G && m == C) continue;
    					dp[i+1][k][l][m] += dp[i][j][k][l];
    					dp[i+1][k][l][m] %= mod;
    				}
    			}
    		}
    	}
    }

    ll res = 0;
	REP(j, 4){
		REP(k, 4){
			REP(l, 4){
				if(j == A && k == G && l == C) continue;
    			if(j == A && k == C && l == G) continue;
    			if(j == G && k == A && l == C) continue;
				res += dp[N][j][k][l];
				res %= mod;
			}
		}
	}
	cout << res << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < k; i++) {
        auto a_old = a;
        vector<int> b(n);
        for (int j = 0; j < n; j++) {
            int rmin = max(0, j - a[j]);
            int rmax = min(n - 1, j + a[j]);
            b[rmin]++;
            if (rmax + 1 < n) {
                b[rmax + 1]--;
            }
        }
        for (int j = 0; j < n - 1; j++) {
            b[j + 1] += b[j];
        }
        for (int j = 0; j < n; j++) {
            a[j] = b[j];
        }
        if (a_old == a) {
            break;
        }
    }
    for (int i = 0; i < n - 1; i++) {
        cout << a[i] << " ";
    }
    cout << a[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 5628
//
//  second.cpp
//  CoderTest
//
//  Created by yuya on 2019/05/23.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    int i;
    int j;
    int k,A;
    int ret = 0;
    
    int N,M;
    cin >> N >> M;
    
    vector<int> foods(M);
    
    for(i=0;i<N;i++){
        cin >> k;
        for(j=0;j<k;j++){
            cin >> A;
            foods[A-1] ++;
        }
    }
    
    for(i=0;i<M;i++){
        if(foods[i]  == N) ret++;
    }
    cout << ret << endl;
    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll n, k;
  cin >> n >> k;
  ll ans = k*pow(k-1, n-1);
  printf("%lld\n", ans);
}


Measured memory_bytes: 384
#include <stdio.h>

int getDigit( int num, int digit )
{
	if( num / 10 == 0 )return (digit);
	else return ( getDigit( num / 10, digit + 1 ) );
}

int main( void )
{
	int a;
	int b;
	
	while( scanf( "%d%d", &a, &b ) != EOF )
	{
		printf( "%d\n", getDigit( a + b, 1 ) );
	}
	return (0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <iomanip>
#include<algorithm>
#define ll long long
using namespace std;

int main() {
  ll N, M, X, sumprice = 0, min = 10000000;
  cin >> N >> M >> X;
  vector<ll> C(12, 0), sum(M, 0);
  vector<vector<ll>> A(12, vector<ll>(M));
  bool judge = 1;
  for(ll i = 0; i < N; i++) {
    cin >> C.at(i);
    sumprice += C.at(i);
    for(ll j = 0; j < M; j++) {
      cin >> A.at(i).at(j);
      sum.at(j) += A.at(i).at(j);
      if((i == N - 1) && (sum.at(j) < X)) judge = 0;
    }
  }
  if(judge == 0) cout << -1 << endl;
  else {
    vector<ll> sumcharge(M);
    ll sumpricecharge;
    for(ll i = 0; i < M; i++) sumcharge.at(i) = sum.at(i);
    sumpricecharge = sumprice;
    for(ll i = 0; i < pow(2, N); i++) {
      for(ll k = 0; k < M; k++) sum.at(k) = sumcharge.at(k);
      sumprice = sumpricecharge;
      if(i % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(0).at(j);
        }
        sumprice -= C.at(0);
      }
      if((i / 2) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(1).at(j);
        }
        sumprice -= C.at(1);
      }
      if((i / 4) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(2).at(j);
        }
        sumprice -= C.at(2);
      }
      if((i / 8) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(3).at(j);
        }
        sumprice -= C.at(3);
      }
      if((i / 16) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(4).at(j);
        }
        sumprice -= C.at(4);
      }
      if((i / 32) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(5).at(j);
        }
        sumprice -= C.at(5);
      }
      if((i / 64) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(6).at(j);
        }
        sumprice -= C.at(6);
      }
      if((i / 128) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(7).at(j);
        }
        sumprice -= C.at(7);
      }
      if((i / 256) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(8).at(j);
        }
        sumprice -= C.at(8);
      }
      if((i / 512) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(9).at(j);
        }
        sumprice -= C.at(9);
      }
      if((i / 1024) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(10).at(j);
        }
        sumprice -= C.at(10);
      }
      if((i / 2048) % 2 == 1) {
        for(ll j = 0; j < M; j++) {
          sum.at(j) -= A.at(11).at(j);
        }
        sumprice -= C.at(11);
      }
      for(ll j = 0; j < M; j++) {
        if(sum.at(j) < X) break;
        if((j == M - 1) && (sumprice < min)) min = sumprice;
      }
    }
    cout << min << endl;
  }
}

Measured memory_bytes: 4120
//
// Created by nhatminh2947 on 7/3/19.
//

#include <bits/stdc++.h>

using namespace std;

int n;
int d[100000];

int main() {

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> d[i];
    }
    sort(d, d+n);
    cout << d[n/2] - d[n/2-1] << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
int main() {
	using namespace std;
	int d, n;
	cin >> d >> n;
	if (n == 100) n++;
	if (d == 0) {
		cout << n;
		return 0;
	}
	else if(d==1){
		cout << n * 100;
		return 0;
	}
	cout << n * 10000;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll in()
{
    ll res=0,p=1;
    char c=getchar();
    while(c<'0'||c>'9') {if(c=='-') p=-1; c=getchar();}
    while(c>='0'&&c<='9') res=res*10+c-48,c=getchar();
    return p*res;
}
void out(ll x)
{
    if (x>9) out(x/10);
    putchar(x%10+48);
}
const int mod = 1e9 + 7, inf = 0x3f3f3f3f;
ll quickpow(ll x, ll k)
{
    ll res = 1;
    while(k){
        if(k & 1) res = (res * x) % mod;
        k >>= 1, x = (x * x) % mod;
    }
    return res;
}
const int maxn = 1e6 + 5;

int a[105];
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    int ans = 0;
    for (int i = 0; i < n; ++i){
        for (int j = i + 1; j < n; ++j){
            for (int k = j + 1; k < n; ++k){
                if (a[i] != a[j] && a[i] != a[k] && a[j] != a[k] && a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i]) ++ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>

using namespace std;

const int MAX_K = 300001;
bool fact_initialized = false;
long long fact[MAX_K], fact_inv[MAX_K], inv[MAX_K];

void combination_init(int mod)
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;

    for(int i = 2; i < MAX_K; ++i)
    {
        fact[i] = fact[i-1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i-1] * inv[i] % mod;
    }
}

long long combination_mod(long long n, long long k, int mod)
{
    if (n < k || n < 0 || k < 0) return 0;
    if(!fact_initialized)
    {
        combination_init(mod);
        fact_initialized = true;
    } 
    return fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) % mod;
}

int main()
{
    long long n, a, b;
    long long k;
    long long mod = 998244353;
    long long ret = 0;
    cin >> n >> a >> b >> k;
    
    if (k == 0)
    {
        ret = 1;
    }
    else
    {
        for(long long i=0; i <= n; ++i)
        {
            if (((k - i * a) % b) == 0) // ax + by = n
            {
                ret = (ret + combination_mod(n, i, mod) * combination_mod(n, (k - i * a) / b, mod) % mod) % mod;
            }
        }
    }
    cout << ret % mod << endl;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#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 ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main()
{
    int x, a;
    cin >> x >> a;
    if(x >= a) cout << 10 << endl;
    else cout << 0 << endl; 
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <sstream>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

#define MAX_I (1001)

class Data{
public:
	int e;
	long pq;
	int i;

	Data() : e(0), pq(0), i(MAX_I){
		return;
	}

	~Data(){
		return;
	}

	bool operator < (const Data &r){
		return this->i < r.i;
	}
};

int main(int argc, char **argv){
	int n, e, p, q;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


#if INPUT_FROM_FILE
	while(ifs >> n){
#else
	while(std::cin >> n){
#endif
		if(n == 0){ break; }

		std::vector<Data> data(4001);
		std::vector<int> result;

		for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
			ifs >> e >> p >> q;
#else
			std::cin >> e >> p >> q;
#endif
			if(data[e].i == MAX_I){
				data[e].i = i;
			}
			data[e].e = e;
			data[e].pq += p * q;
		}

		std::sort(data.begin(), data.end());

		for(int i = 0; i < data.size(); i++){
			if(data[i].pq >= 1000000){
				result.push_back(data[i].e);
			}
		}
		if(result.empty()){
			std::cout << "NA" << std::endl;
		}
		else{
			for(int i = 0; i < result.size(); i++){
				std::cout << result[i] << std::endl;
			}
		}
	}
	

#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>

int main() {
  int x,i;
  i = 1;
  while(1){
    scanf("%d", &x);
    if ( x == 0 ) {
      break;
    } else {
      printf("Case %d: %d\n",i,x);
      i = i + 1;
    }
  }
}


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

int main() {
	int a[3][3],i,j,b[3][3];
	for(i=0;i<3;i++)
	{
	    for(j=0;j<3;j++)
	   { cin>>a[i][j];
	     b[i][j]=0;
	   }
	}
	int n;
	cin>>n;
	int arr[n];
	for(i=0;i<n;i++)
	cin>>arr[i];
	int k,z=0;
	for(k=0;k<n;k++)
	{
	    z=0;
	   	for(i=0;i<3;i++)
	{
	    for(j=0;j<3;j++)
	   { 
	       if(arr[k]==a[i][j])
	       {
	           b[i][j]=1;
	           z=1;
	           break;
	       }
	       if(z==1)
	       break;
	   }
	}  
	}
	int f=0,num=0;
	for(i=0;i<3;i++)
	{
	    num=0;
	    for(j=0;j<3;j++)
	    {
	        if(b[i][j]==1)
	        num++;
	    }
	    if(num==3)
	    f=1;
	}
		for(i=0;i<3;i++)
	{
	    num=0;
	    for(j=0;j<3;j++)
	    {
	        if(b[j][i]==1)
	        num++;
	    }
	    if(num==3)
	    f=1;
	}
	if(b[0][0]==1&&b[1][1]==1&&b[2][2]==1)
	f=1;
	if(b[2][0]==1&&b[1][1]==1&&b[0][2]==1)
	f=1;
	if(f==1)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using VVI = vector<vector<int>>;
using VI  = vector<int>;
const static string el = "\n";

int main()
{
  int n;
  cin >> n;
  
  unsigned long long total = 0;
  VI a(100001);
  for (int i = 0; i < n; i++)
  {
    int tmp; cin >> tmp;
    a[tmp]++;
    total += tmp;
  }
  
  int q; cin >> q;
  int replace_count = 0;
  for (int i = 0; i < q; i++)
  {
    int b,c; cin >> b >> c;
    if (a[b] != 0)
    {
      a[c] += a[b];
      replace_count = a[b];
      a[b] = 0;
    }
    
    // 総和の計算
    if(replace_count > 0) 
    {
      int df = c - b; // 負数もあり得る
      total += df * replace_count;
      cout << total << el;
      replace_count = 0;
    }
    else 
    {
      cout << total << el;
    }
  }
  return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long 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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) puts("Yes");
  else puts("No");

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int a;
    cin >> a;
    cout << a + a*a + a*a*a << "\n";
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

int main() {
  llong K;
  cin >> K;
  llong ans = -1;
  llong mod = 0;
  llong ten = 1;
  for (int i = 1; i <= K; i++) {
    mod = (mod + 7 * ten) % K;
    ten = (ten * 10) % K;
    if (mod == 0) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;


int main()
{
      string s , t ,u;
      int a , b;
      cin >> s >> t;
      cin >> a >> b;
      cin >> u;
      if(u == s)
            a--;
      else if(u == t)
            b--;
      cout << a << " " << b;

    return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll x,a;
  cin>>x>>a;
  ans(x<a,0,10);

  return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc147/tasks/abc147_c

#include "algorithm"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  V<V<PL>> st(N, V<PL>(0));

  rep(i, N) {
    ll a;
    cin >> a;

    rep(j, a) {
      ll x, y;
      cin >> x >> y;
      x--;

      st[i].emplace_back(x, y);
    }
  }

  ll res = 0;

  auto satisfied = [st, N](ll digit) -> bool {
    VL facts(N, -1);  // 0: 嘘, 1: 本当

    rep(i, N) {
      auto fact = (digit >> i) & 1;

      if (facts[i] != -1 && facts[i] != fact) return false;

      facts[i] = fact;

      if (!fact) continue;

      for (auto pa : st[i]) {
        if (facts[pa.fi] != -1 && facts[pa.fi] != pa.se) return false;

        facts[pa.fi] = pa.se;
      }
    }

    return true;
  };

  rep(digit, 1 << N) {
    if (satisfied(digit)) {
      ll ct = 0;

      for (ll mask = 1; mask != 0; mask <<= 1) {
        if ((digit & mask) != 0) ct++;
      }

      chmax(res, ct);
    }
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	
	public static int lcm(int a, int b) {
		return a / gcd(a, b) * b;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		System.out.println(lcm(360, X)/X);
	}

}


Measured memory_bytes: 35804
use std::cmp::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve(n: usize, k: usize, h: Vec<i64>) {
    let mut dp = vec![std::i64::MAX; n];
    dp[0] = 0;
    dp[1] = (h[0] - h[1]).abs();
    for i in 2..n {
        let sta = if i > k { i-k } else { 0 };
        for j in sta..i {
            let t = (h[i] - h[j]).abs() + dp[j];
            dp[i] = min(dp[i], t);
        }
    }
    println!("{}", dp[n - 1]);
}

fn main() {
    input! {
        n: usize,
        k: usize,
        h: [i64; n],
    }

    solve(n, k, h);
}


Measured memory_bytes: 6396
import scala.collection.mutable

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val k = sc.nextInt()
  var e = List[(Int, Int, Int)]()
  for (i <- 0 until k) {
    if (i % 10 != 9) {
      e ::= (i, (i+1) % k, 1)
    }
    e ::= (i, (10 * i) % k, 0)
  }

  val sp = binaryBfs(1, k, e)
  println(sp(0) + 1)

  def binaryBfs(s: Int, n: Int, edges: Seq[(Int, Int, Int)]): Array[Int] = {
    val adj = Array.fill(n)(List[(Int, Int)]())
    for ((u, v, w) <- edges) {
      adj(u) ::= (v, w)
    }

    val sp = Array.fill(n)(-1)
    sp(s) = 0
    val deque = mutable.ArrayDeque[Int]()
    deque.append(s)
    while (deque.nonEmpty) {
      val u = deque.removeHead()
      for ((v, w) <- adj(u) if (sp(v) == -1 || sp(u) + w < sp(v))) {
        sp(v) = sp(u) + w
        if (w == 0) {
          deque.prepend(v)
        } else {
          deque.append(v)
        }
      }
    }
    sp
  }
}


Measured memory_bytes: 96588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

long double v[60];

ll COM[60][60];

void COMinit(void){
    rep(i,60){
        rep(j,60){
            if(i<j) {
                COM[i][j]=0;
                continue;
            }
            if(i==0) {
                COM[i][j]=0;
                continue;
            }
            if(j==0) {
                COM[i][j]=1;
                continue;
            }
            if(i==j){
                COM[i][j]=1;
                continue;
            }
            COM[i][j]=COM[i-1][j-1]+COM[i-1][j];
        }
    }
}


void solve(){

    COMinit();

    ll n,a,b;
    cin >> n >> a >> b;
    rep(i,n){
        cin >> v[i];
    }
    sort(v,v+n, greater<long double>());
    long double avg=0;
    rep(i,a){
        avg += v[i];
    }
    avg /= a;
    cout << setprecision(18) << avg << endl;

    if(v[0]!=v[a-1]){
        ll x=0;
        ll y=0;
        rep(i,n){
            if(v[i]==v[a-1]){
                if(i<=a-1) x++;
                else y++;
            }
        }
        cout << COM[x+y][x] << endl;
    }

    else{
        ll count = 0;
        rep(i,n){
            if(v[i]==v[0]) count++;
        }

        ll ans=0;
        if(count>=b){
            for(ll t=a; t<=b; t++){
                ans += COM[count][t];
                //cout << "count:" << count << " t:" << t << " C:" <<  COM[count][t] << endl;
            }
        }
        else{
            for(ll t=a; t<=count; t++){
                ans += COM[count][t];
            }
        }
        //cout << count << endl;

        cout << setprecision(20) << ans << endl;
    }
    

}

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


Measured memory_bytes: 256
n=int(input())
li = list(map(int,input().split()))
count_li = [0] * (len(li)-1)

for i in range(len(li)-1):
    if li[i] >= li[i+1]:
        count_li[i] += 1
        
count = 0
max_ = 0
for i in range(len(count_li)):
    if count_li[i] != 0:
        count += 1
    else:
        if count >= max_:
            max_ = count
        count = 0
        
if count >= max_:
    max_ = count
print(max_)

Measured memory_bytes: 14252
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    ll n, k; cin >> n >> k;
    int ans = 0;
    int k_ = 1;
    while(k_ <= n){
        k_ *= k;
        ++ans;
    }

    cout << ans << endl;

return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
using namespace std;


int main(int argc, const char * argv[]) {
  string s;
  cin >> s;
  for(int i = 0; i < s.size() - 1; i++){
    if(s.at(i) == s.at(i+1)){
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;

  return 0;
}


Measured memory_bytes: 256
N,Y = map(int, input().split())

sum = 0
cnt = 0
for x in range(N+1):
    for y in range(N+1-x):
        sum = 10000*x + 5000*y + 1000*(N-x-y)
        if sum == Y:
            cnt += 1
            print(str(x) + ' ' + str(y) + ' ' + str(N-x-y))
            break
    else:
        continue
    break
if cnt == 0:
    print('-1 -1 -1')

Measured memory_bytes: 3064
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int n;
int res[200000+20];
int main(){
	fastio;
	cin>>n;
	rb(i,1,n-1)
	{
		int a;
		cin>>a;
		res[a]++;
	 } 
	rb(i,1,n)
		cout<<res[i]<<endl;
	return 0;
}


Measured memory_bytes: 4432
#include <bits/stdc++.h>
using namespace std;
struct P
{
    //string r;
    int x,y,z;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x>a.x;
//        return z>a.z;
    }
};

vector<int> v;

int a,b,c,i,k,d,n,m,e[1111111];//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};
long long l[125555];
int o[3][115][112];
int dx[10]={0,1,0,-1},dy[10]={1,0,-1,0},dz[10]={0,0,0,0,1,-1};

long long x,y,z[5555],mod=1000000007;
P u[222222];
long long j[115552];

stack<int> s;
queue<P> q;
bool qw[3333];
//deque<int> de;
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
map<int,int > p;
string r,r1,r2,r3,r4,r5;
//char r[333][333];

bool as(P a,P b)
{

    return a.y<b.y;
}
//queue<P> q;



int main()
{
    scanf("%d %d %d",&n,&a,&b);
    if((b-a)%2==0) printf("Alice");
    else printf("Borys");
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>

#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <limits>
using namespace std;

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

void Main()
{
	int N;
	cin >> N;

	bool isThree = true;
	rep(i, N)
	{
		char C;
		cin >> C;
		if (C == 'Y')
		{
			isThree = false;
			break;
		}
	}

	cout << (isThree ? "Three" : "Four") << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
 
const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007
 
 
#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair
 
#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define rlo(i,n) for(int i=n-1;i>=0;i--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define pr(a) {for(auto x:a)cout<<x<<" ";cout<<nl;}
 
#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
 
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}
 
void f()
{
  ll n,cnt=0;
  cin>>n;
  ll a[n];
  lo(i,0,n)
    cin>>a[i];
  sort(a,a+n);
  for(int i=0;i<n;i++)
  {
    for(int j=i+1;j<n;j++)
    {
      for(int k=j+1;k<n;k++)
      {
		if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i])
		{
          if(a[i]+a[j]>a[k])
            cnt++;
		}
      }
    }
  }

  cout<<cnt<<nl;

}
 
int main()
{
    su;
	///tt
    f();
    return 0;
}

Measured memory_bytes: 3648
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];puts("");}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};//RDLU
#define yes puts("YES")
#define no puts("NO")

int dp[10010][110][2];
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin>>n;
	vvi in(n,vi(n));
	rep(i,n)rep(j,n)cin>>in[i][j];

	int N=1<<n;
	vi co(N);
	rep(i,N){
		int sum=0;
		rep(j,n)loop(k,j+1,n)if((i&1<<j)&&(i&1<<k))sum+=in[j][k];
		co[i]=sum;
	}
	vi dp(N,-inf);
	dp[0]=0;
	rep(i,N)for(int j=i;j<N;j=(j+1)|i)
		cmax(dp[j],dp[i]+co[j-i]);

	cout<<dp[N-1]<<endl;
}


Measured memory_bytes: 1280
from bisect import bisect_left
N = int(input())
L = list(map(int, input().split()))
L.sort()
cnt = 0
for b in range(N):
    for a in range(b):
        ab = L[a] + L[b]
        r = bisect_left(L, ab)
        cnt += r - (b + 1) 
print(cnt)

Measured memory_bytes: 3188
import Control.Applicative

calc :: Integer -> String -> Integer -> Integer
calc a "+" b = a + b
calc a "-" b = a - b
calc a "*" b = a * b
calc a "/" b = a `div` b

parser :: IO ()
parser = do
    args <- words <$> getLine
    if (args !! 1 == "?")
    then return ()
    else do
        putStrLn (show (calc (read (args !! 0)) (args !! 1) (read (args !! 2))))
        parser

main = parser

Measured memory_bytes: 4080
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#pragma region
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#pragma endregion


void solve()
{
    int d, t, s; cin>>d>>t>>s;
    double f = 1.0*d/s;
    if (f <= t) cout << "Yes\n";
    else cout << "No\n";
}

signed main()
{
    int T = 1;
    ios_base::sync_with_stdio(0); cin.tie(0);
    //cin >> T;
    for(int i=1;i<=T;++i)
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define M 100005
#define rep(i,a,b) for(lli i=a;i<b;i++)
#define pii pair<lli,lli> 
#define Itr vector<lli> :: iterator
void fast()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
}

lli a[M] ; 
int main()
{
	fast();
	lli t,n;
	t=1;
	while(t--)
	{
		cin>>n;
		string s;
		char prev='@';
		cin>>s;
		lli ctr=0,seen=0,ans;
		rep(i,0,s.length())
		{
			if(s[i]!=prev)
			{
				seen++;
				ctr++;
			}
			prev = s[i];
		} 
		if(!seen)ctr=1;
		ans=ctr;
		cout<<ans<<"\n";
	}
return 0;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vi cnt(n + 1, 0);
	REP(i, m) {
		int l, r;
		cin >> l >> r;
		cnt[r]--;
		cnt[l - 1]++;
	}
	REP(i, n)cnt[i + 1] += cnt[i];
	int ans = 0;
	REP(i, n)if (cnt[i] == m)ans++;
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n,d,x,ans;
  cin >> n >> d >> x;
  
  rep(i,n){
    int a;
    cin >> a;
    int day = 1;
    while(day <= d){
      ans++;
      day += a;
    }
  }
  
  ans += x;
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
		int counter =0;
		
		for(int i=0;i!=n-2;i++){
			if(s.Substring(i,3)=="ABC"){
				counter++;
			}
		}
		
		Console.WriteLine(counter);
		
	}
}

Measured memory_bytes: 11092
package main

import (
	"fmt"
)

func main() {
	var s, w int

	_, _ = fmt.Scanf("%d %d", &s, &w)

	fmt.Println(answer164A(s, w))

}

func answer164A(s int, w int) string {
	if s <= w {
		return "unsafe"
	}
	return "safe"
}


Measured memory_bytes: 1836
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
const double PI  =3.141592653589793238463;
using namespace std;
using ll = long long;
const ll INF = +10010010000;
typedef pair<ll,ll> P;
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    ll ans = 0;
    rep(i,n-1){
        if(s[i] == s[i+1])++ans;
    }
    ans = min((ll)n-1,ans+2*k);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
	char s1[3], s2[3];
	int count = 0, i = 0;
	char c;

	while ((c = getchar()) != '\n')
	{
		s1[i] = c;
		i++;
	}

	i = 0;

	while ((c = getchar()) != '\n')
	{
		s2[i] = c;
		i++;
	}

	for (int i = 0; i < 3; i++)
	{
		if (s1[i] == s2[i])
		{
			count++;
		}
	}

	printf("%d", count);


	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define _GLIBCXX_DEBUG

int main(void){

    long double X;

    cin >> X;

    // int ans = 0;
    int flag = 0;

    long double a, b, result;

    for(a=1; a < 1000; a++){

        for(b=-1000; b < a; b++){
            result = a*a*a*a + a*a*a*b + a*a*b*b + a*b*b*b + b*b*b*b;
            
            if(result == (X/(a-b))){
                flag = 1;
                break;
            }
        }
        if(flag==1){
            break;
        }
    }

    cout << a << " " << b << endl;

}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    vector<int> v(5);
    for(int i=0;i<5;i++){
        cin>>v[i];
    }
    int k;
    cin>>k;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            if(v[j]-v[i]>k){
                cout<<":("<<endl;
                return 0;      
            }
        }
    }
    cout<<"Yay!"<<endl;
    return 0;
}

Measured memory_bytes: 256
class BIT:
  def __init__(self, n):
    self.N = n+1
    self.bit = [0]*self.N
  
  def bit_sum(self, i):
    s = 0
    i += 1
    while i>0:
      s += self.bit[i]
      i -= i & -i
    return s

  def bit_add(self, i, n):
    i += 1
    while i<self.N:
      self.bit[i] += n
      i += i & -i

N, *A = map(int, open(0).read().split())
inf = [(a,i) for i, a in enumerate(A)]
n = A[0]
ls = [0]
for i in range(1,N):
  if A[i]>n:
    n = A[i]
    ls.append(i)
B = BIT(N)
C = BIT(N)
inf.sort(reverse=True)
cnt = [0]*N
ccnt = [0]*N
for a,i in inf:
  B.bit_add(i,a)
  cnt[i] = B.bit_sum(N-1)-B.bit_sum(i)
for a, i in inf:
  C.bit_add(i,1)
  ccnt[i] = C.bit_sum(N-1)-C.bit_sum(i)

ans = [0]*N
s = sum(A)
p = 0
x = 0
for i in range(len(ls)-1,0,-1):
  a = ls[i]
  b = ls[i-1]
  m = cnt[b]-A[b]*ccnt[b]
  n = m-x
  ans[a] = n
  s -= n
  x += ans[a]
ans[0] = s
print('\n'.join(map(str,ans)))


Measured memory_bytes: 45436
N = int(input())
C0=0
C1=0
C2=0
C3=0

for i in range(N):
    S = input()
    if S=='AC':
        C0 += 1
    elif S=='WA':
        C1 += 1
    elif S=='TLE':
        C2 += 1
    elif S=='RE':
        C3 += 1

print('AC x '+str(C0))
print('WA x '+str(C1))
print('TLE x '+str(C2))
print('RE x '+str(C3))

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

int main() {
    int64_t N;
    cin >> N;
    vector<int64_t> A(N);
    for (int64_t& a : A) {
        cin >> a;
    }

    sort(A.begin(), A.end());

    int64_t ans = 0;
    set<int64_t> st;
    for (int64_t i = 0; i < N; i++) {
        if (i < N - 1 && A[i] == A[i + 1]) {
            st.insert(A[i]);
            continue;
        }

        int64_t a = A[i];
        bool ok = true;
        for (int64_t j = 1; j * j <= a; j++) {
            if (a % j == 0) {
                if (st.count(j) != 0 || st.count(a / j) != 0) {
                    //ダメ
                    ok = false;
                    break;
                }
            }
        }

        if (ok) {
            ans++;
            st.insert(a);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 13868
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var [n,m] = nexts(2);
  var ans = [];
  if(n & 1){
    for(var i = 1; i <= m; i++){
      ans.push(i+" "+(n-i));
    }
  }else{
    for(var i = 1; i <= m+1>>1; i++){
      ans.push(i+" "+(n-i+1));
    }
    for(; i <= m; i++){
      ans.push(i+" "+(n-i));
    }
  }
  return ans.join("\n");
}

Measured memory_bytes: 47752
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

string s;
int a, b;
bool ta = true, mu = true;

signed main() {
	cin >> s;
	a = stoi(s.substr(0,2));
	b = stoi(s.substr(2, 2));
	if (a > 12||a<=0)mu = false;
	if (b > 12||b<=0)ta = false;
	if (ta&&mu)cout << "AMBIGUOUS" << endl;
	else if (ta)cout << "YYMM" << endl;
	else if (mu)cout << "MMYY" << endl;
	else cout << "NA" << endl;
}

Measured memory_bytes: 256