akhauriyash/Code-Regression huggingface dataset:
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	string str; cin >> str;
	str.insert(str.begin(), 'C');
	ll a = 0;
	ll ans = 0;
	rep2(i, 1, str.size()){
		if(str[i] == 'A'){
			if(str[i-1] != 'A') a = 0;
			a++;
			continue;
		}
		if(str[i] == 'C'){
			if(str[i-1] == 'B'){
				str[i] = 'A';
				ans += a;
			}
			else{
				a = 0;
			}
		}
		if(str[i] == 'B'){
			if(str[i-1] != 'A'){
				a = 0;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#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 1e9
// template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
// template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;

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

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

    int n, m, flag=0;
    cin >> n >> m;
    int s[m], c[m];
    REP(i,m){
        cin >> s[i] >> c[i];   
    }

    int tmp[n], rsv[n];

    REP(i,n){
        tmp[i] = 0;
        rsv[i] = 0;
    }

    REP(i,m){
        if (s[i]==1 & c[i]==0 & n>1){
            flag=1;
            break;
        }
        if (rsv[s[i]-1]==0){
            tmp[s[i]-1]=c[i];
            rsv[s[i]-1]=1;
        } else {
            if (tmp[s[i]-1]!=c[i]){
                flag=1;
                break;
            }
        }
    }

    if (n>1 & tmp[0]==0){
        tmp[0]=1;
    }

    if (flag==1){
        cout << -1;
    } else {
        REP(i,n){
            cout << tmp[i];
        }
    }
   
}


Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
 
using namespace std;
 
struct Node{
  int key;
  Node* next;
  Node* prev;
};
 
struct List{
  Node* nil;
 
  void init(){
    nil=(Node*)malloc(sizeof(Node));
    nil->next=nil;
    nil->prev=nil;
    nil->key=0;
  }
 
  Node* find(int key){
    for(Node* i=nil->next;i!=nil;i=i->next){
      if(i->key==key)return i;
    }
    return nil;
  }
 
  void insert(Node *x){
    x->next=nil->next;
    nil->next->prev=x;
    nil->next=x;
    x->prev=nil;
  }
  
  void add(int x){
    Node* p = (Node*)malloc(sizeof(Node));
    p->key=x;
    insert(p);
  }
   
  void delete_x(int key){
    Node* x=find(key);
    if(x==nil)return;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);
  }
   
  void deleteFirst(){
    Node* x = nil->next;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);
  }
   
  void deleteLast(){
    Node* x = nil->prev;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);   
  }
 
  void output(){
    int flg=0;
    for(Node* i=nil->next;i!=nil;i=i->next){
      if(flg)cout<<' ';
      cout<<i->key;
      flg=1;
    }
    cout<<endl;
  }
};
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  List list;
  list.init();
  int n,x;
  string str;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>str;
    if(str=="insert"){
      cin>>x;
      list.add(x);
    }else if(str=="delete"){
      cin>>x;
      list.delete_x(x);
    }else if(str=="deleteFirst"){
      list.deleteFirst();
    }else {
      list.deleteLast();
    }
  }
  //cout<<'-'<<endl;
  list.output();
}



Measured memory_bytes: 34400
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include<numeric>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    int w,h,x,y,r; cin >> w>>h>>x>>y>>r;
    if( (x + r) > w || (y + r) > h || x < 0 || y < 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
	return 0;
}



Measured memory_bytes: 3124
h,w = map(int,input().split())
s = [0]*(h+2)
s[0] = ["."]*(w+2)
s[-1] = ["."]*(w+2)
for i in range(1,h+1):
    s[i] = ["."] + list(input()) + ["."]
ans = 1
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] == "#":
            if s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == ".":
                ans = 0
                break
print(["No","Yes"][ans])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define DEBUG 0 
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

int main(){
    char s[100]={},t[100]={};
    scanf("%s",s);
    int len=strlen(s);
    for(int i=0;i<len;i++){
        t[i]=s[len-i-1];
    }
    t[len]='\0';

#if DEBUG 
    cout<<s<<endl;
    cout<<t<<endl;
#endif
    rep(i,len){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }

    int mid=(len-1)/2;
    for(int i=0;i<mid;i++){
        t[i]=s[mid-i-1];
    }
    t[mid]='\0';
    
#if DEBUG 
    cout<<s<<endl;
    cout<<t<<endl;
#endif
    rep(i,mid){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    for(int i=mid+2;i<len;i++){
        t[i]=s[len-i-1];
    }

    for(int i=mid+2;i<len;i++){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M=1002;
const ll mod=1e9+7;
ll dp[M][M],cmb[M][M],fact[M][M];
ll power(ll a,ll b)
{
	ll val=1;
	while(b)
	{
		if(b%2)
			val=(val*a)%mod;
		b/=2;
		a=(a*a)%mod;
	}
	return val;
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	dp[a-1][0]=1;
	cmb[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		cmb[i][0]=1;
		for(int j=1;j<=i;j++)
			cmb[i][j]=(cmb[i-1][j]+cmb[i-1][j-1])%mod;
	}
	// cout<<cmb[4][2]<<endl;
	fact[0][1]=1;
	for(ll i=1;i<=n;i++)
	{
		fact[i][1]=(fact[i-1][1]*i)%mod;
		for(ll j=2;j<=n;j++)
			fact[i][j]=(fact[i][j-1]*fact[i][1])%mod;
	}	
	for(int i=a;i<=b;i++)
	{
		for(int j=0;j<=n;j++)
		{
			dp[i][j]=dp[i-1][j];
			for(int k=c;k<=d;k++)
			{
				if(i*k>j)
					break;
				ll res = (cmb[j][i*k]*dp[i-1][j-i*k])%mod;
				res = (res*fact[k*i][1])%mod;
				res = (res*power(fact[i][k],mod-2))%mod;
				res = (res*power(fact[k][1],mod-2))%mod;
				dp[i][j]=(dp[i][j]+res)%mod;
			}
		}
	}
	cout<<dp[b][n]<<"\n";
	
	return 0;
}

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

int n, size;
int memo[5010][5010];

#define MOD 1000000007

long long pow_mod(long long n, long long m){
  int ans = 1;
  while(m > 0){
    if(m & 1) ans = (ans * n) % MOD;
    n = (n*n) % MOD;
    m >>= 1;
  }
  return ans;
}

long long dfs(int i, int s){
  if(memo[i][s] != -1) return memo[i][s];
  if(i == n){
    if(s == size){
      return 1;
    }else{
      return 0;
    }
  }

  return memo[i][s] = (dfs(i+1,min(s+1,5000))*2 + dfs(i+1,max(s-1,0))) % MOD;
}

int main(){
  cin >> n;
  string s;
  cin >> s;
  size = s.size();

  memset(memo,-1,sizeof(memo));
  cout << (dfs(0, 0) * pow_mod(pow_mod(2,size),MOD-2))%MOD/**/ << endl;
  return 0;
}


Measured memory_bytes: 98688
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long INF = 1e9 + 7;
using namespace std;
typedef long long ll;
map<int, int> mp;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long a, b, c;
	cin >> a >> b >> c;
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		cout << 0 << endl;
	}
	else {
		cout << min(min(b * c, c * a), a * b) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
a = [int(x) for x in input().split()]
counter = 0

while 1:
    binOR = 0
    for num in a:
        binOR = binOR | num
    if (binOR & 1) == 0:
        counter += 1
        a = [x//2 for x in a]
    else:
        break;
        
print(counter)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define P pair<int,int>
#define prique priority_queue
int n,h[40],minv=0,ans=0;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>h[i];
        if(minv<=h[i]){
            ans++;
            minv=h[i];
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < (n); i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 100005;
int n, sig[MX][2], sz, cn[2];
ll l;

void add (string &s) {
	for (int i = 0, u = 0; i < s.size(); i++) {
		if (!sig[u][s[i] - '0'])
			sig[u][s[i] - '0'] = ++sz;
		u = sig[u][s[i] - '0'];
	}
}

ll lsb (ll n) {
	return n & -n;
}

ll dfs (int i, ll l) {
	ll res = 0;

	if (sig[i][0]) {
		if (!sig[i][1]) res ^= lsb(l);
		res ^= dfs(sig[i][0], l - 1);
	}

	if (sig[i][1]) {
		if (!sig[i][0]) res ^= lsb(l);
		res ^= dfs(sig[i][1], l - 1);
	}

	return res;
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> l;
	while (n--) {
		string s;
		cin >> s;
		add(s);
	}

	if (dfs(0, l)) cout << "Alice" << endl;
	else cout << "Bob" << endl;

	return 0;
}

Measured memory_bytes: 4332
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val ss = (1..n).map {
        readLine()!!.toCharArray().map { it.toInt() - 'a'.toInt() }
    }

    var maxfrq=IntArray(26,{50})
    ss.forEach {
        var frq=IntArray(26)
        it.forEach{ frq[it]++ }
        for(i in 0..25){
            maxfrq[i]=Math.min(maxfrq[i],frq[i])
        }
    }

    for(i in 0..25){
        repeat(maxfrq[i]){
            print((i+'a'.toInt()).toChar())
        }
    }
    println()

}

Measured memory_bytes: 31808
#include <bits/stdc++.h>
using namespace std;
const int mod=1000000007;
long long dp[100005];
bool a[100005];
int n,m,x;
int main()
{
    scanf(" %d %d",&n,&m);
    for(int i=0;i<m;i++){
        scanf(" %d",&x);
        a[x]=1;
    }
    dp[0]=1;dp[1]=(a[1]==1?0:1);
    for(int i=2;i<=n;i++)
        dp[i]=(a[i]==1?0:dp[i-1]+dp[i-2])%mod;
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 1152
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
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; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  string s;
  while (cin >> s) {
    int a = 0, b = 0;
    loop(i, 2, s.size()) {
      if (s[i] == 'I' && s[i - 1] == 'O') {
        a += s[i - 2] == 'J';
        b += s[i - 2] == 'I';
      }
    }
    cout << a << endl
         << b << endl;
  }
}

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

using namespace std;

string s,st; int d;

int main()
{
	ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin>>s>>st;
  for (int i=0;i<=2;i++)
  {
  	if(st[i]==s[i]) d++;
  }
  cout<<d;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int

struct edge
{
  int to, cost;
};
typedef std::vector<std::vector<edge>> graph;
const ll MOD = 1000000007;
using namespace std;

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


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

/* Point (x,y)*/
struct P{
  typedef double Type;
  
  Type x,y;
  
  P(Type X,Type Y){
    x = X;
    y = Y;
  }
  
  bool operator< (const P &B) const{
    return x==B.x ? y < B.y : x < B.x;
  }
  
};

/* ConvexHull(??????) */

bool ccw(P &base,P &A,P &B){
  //??´???????????????????????????
  return (A.x-base.x)*(B.y-base.y) - (A.y-base.y)*(B.x-base.x) >= 0; //double?????? -EPS
  
  //??´?????????????????????
  //return (A.x-base.x)*(B.y-base.y) - (A.y-base.y)*(B.x-base.x) > 0; //double?????? EPS
}

vector<P> ConvexHull(vector<P> s){
  vector<P> g;
  int n = (int)s.size();
  
  if(n<3) return s;
  
  sort(s.begin(),s.end());
  
  for(int i=0;i<n;i++){
    for(int m = (int)g.size();m>=2 && ccw(g[m-2],g[m-1],s[i]); m--){
      g.pop_back();
    }
    g.push_back(s[i]);
  }
  
  int t = (int)g.size();
  
  for(int i=n-2;i>=0;i--){
    for(int m = (int)g.size();m>t && ccw(g[m-2],g[m-1],s[i]); m--){
      g.pop_back();
    }
    g.push_back(s[i]);
  }
  
  reverse(g.begin(),g.end());
  g.pop_back();
  
  return g;
}


int main(){
  int n;
  int t[SIZE],d[SIZE];
  int y[SIZE],x[SIZE];
  bool s[SIZE][4] = {};
  vector<P> vec;
  
  scanf("%d",&n);

  y[0] = x[0] = 0;
  

  int dx[4] = {-1,0,1,0};
  int dy[4] = {0,1,0,-1};
  
  for(int i=1;i<n;i++){
    scanf("%d%d",t+i,d+i);

    x[i] = x[t[i]]+dx[d[i]];
    y[i] = y[t[i]]+dy[d[i]];
    s[t[i]][d[i]] = true;
  }

  for(int i=0;i<n;i++){
    vec.push_back(P(y[i],x[i]));
    vec.push_back(P(y[i],x[i]+1));
    vec.push_back(P(y[i]-1,x[i]+1));
    vec.push_back(P(y[i]-1,x[i]));
  }

  vec = ConvexHull(vec);
  
  double ans = LLINF;
  vector<double> theta;

  for(int i=0;i<vec.size();i++){
    theta.push_back(atan((vec[i].y-vec[(i+1)%vec.size()].y)/(vec[i].x-vec[(i+1)%vec.size()].x)));
  }
  theta.push_back(0);
  theta.push_back(M_PI/2);
  
  for(int i=0;i<theta.size();i++){
    double max_y = -INF;
    double max_x = -INF;
    double min_y = INF;
    double min_x = INF;
    
    for(int j=0;j<vec.size();j++){
      
      double x2 = vec[j].y*cos(theta[i])-vec[j].x*sin(theta[i]);
      double y2 = vec[j].y*sin(theta[i])+vec[j].x*cos(theta[i]);
      
      max_y = max(max_y,y2);
      max_x = max(max_x,x2);
      min_y = min(min_y,y2);
      min_x = min(min_x,x2);
      
    }

    ans = min(ans, (max_y-min_y)*(max_x-min_x));
  }

  printf("%.10lf\n",ans);
  
  return 0;
}

Measured memory_bytes: 17164
while True :
    try :
        temp = [int(_) for _ in input().split(',')]
        length, x, y = 0, 0, 0
        for _ in temp[:10] : length += _
        y = (length * temp[-1]) / (temp[-1] + temp[-2])
        x = length - y
        for number, _ in enumerate(temp[:10]) : 
            if x - _ >= 0 : x -= _
            else : 
                if x == 0 : break
                else : 
                    number += 1    
                    break
        print(number)
    except : break

Measured memory_bytes: 7608
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
 
signed main(){
    int N;
    string S;
    cin>>N>>S;
    int r,g,b;
    r=g=b=0;
    REP(i,N){
        if(S[i]=='R')r++;
        if(S[i]=='G')g++;
        if(S[i]=='B')b++;
    }
    int ans=r*g*b;
    for(int i=0;i<N-2;i++){
        for(int j=1;i+2*j<=N-1;j++){
            if(S[i]!=S[i+j]&&S[i+j]!=S[i+j*2]&&S[i]!=S[i+j*2])ans--;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

string sa;

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>sa;
	if(sa.size()==3)reverse(sa.begin(),sa.end());
	cout<<sa<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    string s, t;
    cin >> s >> t;
    int slen = s.size(), tlen = t.size();
    vector<P> tmp(tlen + 1, make_pair(0, -1));
    vector<vector<P>> dp(slen+1, tmp);
    
    rep2(i, 1, slen+1){
        rep2(j, 1, tlen+1){
            if(s[i-1]==t[j-1]){
                // nowdp[j] = predp[j-1] + s[i];
                dp[i][j] = make_pair(dp[i-1][j-1].first+1, 0);
            }else{
                if(dp[i][j-1]>=dp[i-1][j]){
                    // nowdp[j] = nowdp[j-1];
                    dp[i][j] = make_pair(dp[i][j-1].first, 1);
                }else{
                    // nowdp[j] = predp[j];
                    dp[i][j] = make_pair(dp[i-1][j].first, 2);
                }
            }
        }
    }

    int i=slen, j=tlen;
    stack<char> ans;
    while(1){
        int direct = dp[i][j].second;
        if(direct<1){
            if(direct==-1){
                break;
            }else{
                ans.push(s[i-1]);
                i--;
                j--;
            }
        }else{
            if(direct==1){
                j--;
            }else{
                i--;
            }
        }
    }

    while(!ans.empty()){
        cout << ans.top();
        ans.pop();
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 74020
n = gets.to_i
r = gets.split(' ').map{|n| n.to_i}
o = 0

color = Array.new(8, 0)
r.each do |i|
  case i
  when 1..399
    color[0] = 1
  when 400..799
    color[1] = 1
  when 800..1199
    color[2] = 1
  when 1200..1599
    color[3] = 1
  when 1600..1999
    color[4] = 1
  when 2000..2399
    color[5] = 1
  when 2400..2799
    color[6] = 1
  when 2800..3199
    color[7] = 1
  when 3200..4800
    o += 1
  end
end

min = color.count(1)

if o == 0
  max = min
else
  max = min + o
end

min = 1 if min == 0
puts "#{min} #{max}"

Measured memory_bytes: 1788
// ABC176C.cpp :

//#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int a[200005] = {};
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int mn = a[0];
	long long ans = 0;
	for (int j = 1; j < n; j++) {
		if (a[j] < mn) {
			ans += (mn - a[j]);
		}
		else {
			mn = a[j];
		}
	}
	cout << ans << endl;
}


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back

using namespace std;

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

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60, lmod = 1e9+7;

const int MAX_N = 100005;

int main(){
  double x1,y1,x2,y2,x3,y3;
  cin >> x1 >> y1;
  cin >> x2 >> y2;
  cin >> x3 >> y3;
  double a,b,c,r,d,x;
  a = hypot(x1-x2,y1-y2);
  b = hypot(x2-x3,y2-y3);
  c = hypot(x3-x1,y3-y1);
  r = abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/(a+b+c);
  d = max(a,max(b,c));
  x = d/(2+d/r);
  printf("%.12lf",x);
  return 0;
}

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

struct Point{double x,y;};

void koch(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;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(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);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}



Measured memory_bytes: 2716
T = input()
T = [t for t in T]
where = [j for j, i in enumerate(T) if i == '?']
for i in where:
    if i -1 >= 0 and T[i-1] == 'P':
        T[i] = 'D'
    elif i + 1 < len(T)-1 and T[i+1] == 'D':
        T[i] = 'P'
    elif i + 1 < len(T)-1 and T[i+1] == '?':
        T[i] = 'P'
    else:
        T[i] = 'D'
ans = ''
for t in T:
    ans += t
print(ans)

Measured memory_bytes: 18440
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int a,b,c,x,y;
LL ans1,ans2,ans3;
int main() {
	while(~scanf("%d%d%d%d%d",&a,&b,&c,&x,&y)) {

		ans1 = 1LL*a*x + 1LL*b*y;

		ans2 = 1LL*max(x,y)*2*c;

		ans3 = 1LL*min(x,y)*2*c;

		if(x>y) ans3 += 1LL*(x-y)*a;
		else ans3 += 1LL*(y-x)*b;
		
		printf("%lld\n",min({ans1,ans2,ans3}));
	}
	return 0;
}

Measured memory_bytes: 256
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn l2norm(a: &[f64], b: &[f64]) -> f64 {
    a.iter()
        .zip(b.iter())
        .map(|(i, j)| (i - j).powf(2.0))
        .sum::<f64>()
        .sqrt()
}

fn main() {
    let v = read_vec::<f64>();
    let (x1,y1,x2,y2) = (v[0], v[1], v[2], v[3]);
    println!("{}",
        ((x1-x2).powf(2.0) + (y1-y2).powf(2.0)).sqrt());
}



Measured memory_bytes: 5060
N = int(input())
xu=[list(map(str, input().split())) for _ in range(N)]
#print(xu)
sum=0
for i in range(N):
    if xu[i][1]=='JPY':
        sum+=float(xu[i][0])
    else:
        sum+=float(xu[i][0])*380000
print(sum)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
using Graph = vector<vector<int>>;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;

int main (){
string S;
cin>>S;
if(S[0]=='R'){
if(S[1]=='R'){
if(S[2]=='R'){
cout<<3;
return 0;
}
else{
cout<<2;
return 0;
}
}
else{
cout<<1;
return 0;
}
}
else{
if(S[1]=='R'){
    if(S[2]=='R'){
    cout<<2;
    return 0;
    }
    else{
        cout<<1;
        return 0;
    }
}
else{
    if(S[2]=='R'){
    cout<<1;
    return 0;
    }
    else{
        cout<<0;
        return 0;
    }
}
}
}

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

int main() {
    int n;
    cin >> n;
    vector<int64_t> l(n + 1);
    l.at(0) = 2;
    l.at(1) = 1;
    for (int i = 2; i <= n; i++) {
        l.at(i) = l.at(i - 1) + l.at(i - 2);
    }
    cout << l.at(n) << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (x1, y1, x2, y2) = listOfInt()

    val x3 = x2 - (y2 - y1)
    val y3 = y2 + (x2 - x1)
    val x4 = x1 - (y2 - y1)
    val y4 = y1 + (x2 - x1)

    println("$x3 $y3 $x4 $y4")
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

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

int main() {
  int N;
  cin >> N;
  vector<long> a(3*N);
  for(int i = 0; i < 3*N; i++) cin >> a.at(i);
  sort(a.begin(), a.end(), greater<long>());

  long res = 0;
  for(int i = 1; i < 2*N; i += 2) res += a.at(i);
  cout << res << endl;
}


Measured memory_bytes: 2560
move = [[-1, 0], [0, 1], [1, 0], [0, -1]]
def main(n):
    field = [(0, 0)]
    for _ in range(n - 1):
        ni, di = map(int, input().split())
        field.append((field[ni][0] + move[di][0], field[ni][1] + move[di][1]))
    minx = field[0][0]
    maxx = field[0][0]
    miny = field[0][1]
    maxy = field[0][1]
    for fx, fy in field:
        minx = min(minx, fx)
        maxx = max(maxx, fx)
        miny = min(miny, fy)
        maxy = max(maxy, fy)
    print(maxx - minx + 1, maxy - miny + 1)


while 1:
    n = int(input())
    if n == 0:
        break
    main(n)


Measured memory_bytes: 5624
#include<bits/stdc++.h>
using namespace std;
int H,W;
int A[25][25];

int count(int r,int c){
  int res=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      res+=min( abs(r-i) , abs(c-j) ) * A[i][j];
    }
  }
  return res;
}
int main(){
  cin>>H>>W;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>A[i][j];
    }
  }
  int ans=1e9;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      ans=min(ans,count(i,j));
    }
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll int,ll int>
#define pdd pair<double,double>
#define MOD 1000000007
using namespace std;

//--------------------SEGMENT TREE IMPLEMENTATION WITH LAZY UPDATE FOR RANGE SUM----------------

ll int segtree[200005];
ll int arr[100005];
ll int seglazy[200005];

void build(int node,int st,int en)
{
	if(st==en)
	{
		segtree[node]=arr[st];
		return;
	}

	int mid=(st+en)/2;

	build(2*node,st,mid);
	build(2*node+1,mid+1,en);

	segtree[node]=segtree[2*node]+segtree[2*node+1];
}

ll int query(int node,int st,int en,int l,int r)
{
	if(l > en || r < st)
	{
		return 0;
	}

	if(l<=st && r>=en) return segtree[node];

	int mid=(st+en)/2;

	ll int p1=query(2*node,st,mid,l,r);
	ll int p2=query(2*node+1,mid+1,en,l,r);

	return p1+p2;
}

void updateRangeLazy(int node,int st,int en,int l,int r,int val)	// Value changed to 'val'
{
	if(st > en || l > en || r < st) return;

	if(seglazy[node]!=0)
	{
		segtree[node]+=(en-st+1)*seglazy[node];

		if(st!=en)
		{
			seglazy[2*node]+=seglazy[node];
			seglazy[2*node+1]+=seglazy[node];
		}
		seglazy[node]=0;
	}

	if(l<=st && en<=r)
	{
		segtree[node]=(en-st+1)*val;

		if(st!=en)
		{
			seglazy[2*node]+=val;
			seglazy[2*node+1]+=val;
		}
		return;
	}

	int mid=(st+en)/2;

	updateRangeLazy(2*node,st,mid,l,r,val);
	updateRangeLazy(2*node+1,mid+1,en,l,r,val);

	segtree[node]=segtree[2*node]+segtree[2*node+1];
}

//------------------POWER, GCD, LCM and INVERSE MODULO FUNCTIONS-----------------------------

ll int pow(ll int base,ll int p,ll int mod = MOD)
{
	ll int powAns = 1;

	while(p)
	{
		if(p%2)
		{
			powAns=(powAns*base)%mod;
		}

		base=(base*base)%mod;
		p=p/2;
	}

	return powAns;
}

ll int gcd(ll int a, ll int b)
{
	if(b==0) return a;
	else return gcd(b,a%b);
}

ll int lcm(ll int a,ll int b)
{
	return (a*b)/gcd(a,b);
}

ll int invMod(ll int val)
{
	return pow(val,MOD-2,MOD);
}

//---------------------------------MAIN STARTS HERE------------------------------------------

int check(long long int x)
{
	// cout<<"yay : "<<x<<endl;

	int ans  = x&(x-1);

	if(ans==0) return 1;
	else return 0;
}

long long int get2Pow(long long int val)
{
	long long int x = 1;

	while(x<=val)
	{
		x=x*2;
	}

	return x-1;
}

long long int getMax(long long int val)
{
	for(int i=2;i*i<=val;i++)
	{
		if(val%i==0)
		{
			long long int a = i;
			long long int b = val/i;

			return max(a,b);
		}
	}

	return 1;
}

int main()
{
	// freopen("input.txt","r",stdin);		freopen("output.txt","w",stdout);
	
	int u,v;
	int done[5];
	for(int i=0;i<5;i++)
	{
		done[i]=0;
	}

	for(int i=0;i<3;i++)
	{
		cin>>u>>v;
		done[u]++;
		done[v]++;
	}
	int flg=0;
	int oneCnt=0;
	int twoCnt=0;
	for(int i=1;i<=4;i++)
	{
		if(done[i]==0) flg=1;
		if(done[i]==2)
		{
			twoCnt++;
		}
		else if(done[i]==1) oneCnt++;
	}

	if(oneCnt!=2 || twoCnt!=2) flg=1;

	if(!flg) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	string str;
}



Measured memory_bytes: 256
from math import ceil
N,K = map(int,input().split())
A = list(map(int,input().split()))

def possible(l):
    if l==0:
        return False
    c = 0
    for i in range(N):
        if A[i]%l==0:
            n = A[i]//l-1
        else:
            n = A[i]//l
        c += n
    return c<=K

l = 0
r = max(A)
m = (l+r)/2
for i in range(32):
    pos = possible(m)
    if pos:
        r = m
    else:
        l = m
    m = (l+r)/2

if possible(int(m)):
    print(int(m))
else:
    print(ceil(m))

Measured memory_bytes: 93564
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong bignum = 1_000_000_007;
alias Pair = Tuple!(long, "number", long, "times");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n = lread();
    auto b = aryread();
    b.reverse();
    auto ans = new long[](0);

    while (n > 0)
    {
        long i;
        while (1)
        {
            if (i >= n)
            {
                writeln(-1);
                return;
            }

            if (b[i] == n - i)
            {
                ans ~= b[i];
                b = b[0 .. i] ~ b[i + 1 .. n];
                break;
            }

            i++;
        }
        n--;
    }
    foreach_reverse (e; ans)
    {
        e.writeln();
    }
}

Measured memory_bytes: 380
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
char c[11000];
int main(){
	scanf("%s",c+1);
	n=strlen(c+1);
	for(register int i=1;i<=n;i++){
		if(c[i]!=c[n-i+1]){puts("No");return 0;}
	}
	for(register int i=1;i<=(n-1)/2;i++){ 
		if(c[i]!=c[(n-1)/2-i+1]){puts("No");return 0;}
	}
	for(register int i=(n+3)/2;i<=n;i++){
		int r=n+(n+3)/2-i;
		if(c[i]!=c[r]){puts("No");return 0;}
	}
	puts("Yes");
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  string ans = (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f[86];

int main(){
    int N;cin>>N;
    f[0]=2, f[1]=1;
    if(N==1){cout<<1<<endl; return 0;}
    for(int i=2;i<=N;i++){
        f[i] = f[i-1]+f[i-2];
    }
    cout<<f[N];
    
}

Measured memory_bytes: 256
// http://yumai6.hatenablog.com/entry/2015/12/21/222930

#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 llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

//---------------------------------------------------------------
//---------------------------------------------------------------

int N;

signed main(){
	cin >> N;
	int a;
	int cnt = 0;	// 偶数を数える
	REP(i, N) {
		scanf("%d", &a);
		cnt += ((a & 1) == 0) ? 1 : 0;
	}
//	cout << cnt << endl;
	cout << pow(3, N) - pow(2, cnt) << endl;
	
	return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	string s;
	cin >> s;
	if(s[2]==s[3] && s[4]==s[5]) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int n, q; scanf("%d%d", &n, &q);
	std::string s; cin >> s;
	
	std::vector<int> vec;
	for(int i = 0; i < s.size() - 1; i++) {
		if(s.substr(i, 2) == "AC") {
			vec.push_back(i);
		}
	}
	
	while(q--) {
		int a, b; scanf("%d%d", &a, &b);
		
		int R = upper_bound(begin(vec), end(vec), b - 2) - begin(vec);
		int L = lower_bound(begin(vec), end(vec), a - 1) - begin(vec);
		printf("%d\n", R - L);
	}
	return 0;
}


Measured memory_bytes: 1276
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
#define SG getchar()
#define P putchar
using namespace std;
signed main()
{
	char a(SG);SG;char b(SG);
	P(((!(a-b))?('H'):('D')));
	return P(10),0;
}

Measured memory_bytes: 256
#include <stdio.h>

int n, time = 1;
struct {
  int adjacents[101];
  int discoverd_at, done_at;
} G[101];

void depthFirstSearch(int id) {
  int i, j;

  if(G[id].discoverd_at)
    return;

  G[id].discoverd_at = time++;

  for(i = 1;i < n + 1;i++)
    if(G[id].adjacents[i])
      depthFirstSearch(i);

  G[id].done_at = time++;
}

int main() {
  int i, j;
  int u, k, adjacent;

  scanf("%d", &n);
  for(i = 0;i < n;i++) {
    scanf("%d %d", &u, &k);
    for(j = 0;j < k;j++) {
      scanf("%d", &adjacent);
      G[u].adjacents[adjacent] = 1;
    }
  }

  for(i = 1;i < n + 1;i++)
    if(!G[i].discoverd_at)
      depthFirstSearch(i);

  for(i = 1;i < n + 1;i++)
    printf("%d %d %d\n", i, G[i].discoverd_at, G[i].done_at);

  return 0;
}



Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

template<typename F>
decltype(auto) fix(F&& f) {
	return[f = std::forward<F>(f)](auto&&... args) {
		return f(f, std::forward<decltype(args)>(args)...);
	};
}

int main() {
	int n, u, v;
	std::cin >> n >> u >> v;
	--u, --v;

	std::vector<std::vector<int>> edges(n);
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		std::cin >> a >> b;
		--a, --b;

		edges[a].push_back(b);
		edges[b].push_back(a);
	}

	auto dfs = fix([&](auto f, int x, int depth, std::vector<int>& dists) -> void {
		dists[x] = depth;

		for (auto&& to : edges[x])
			if (dists[to] == -1)
				f(f, to, depth + 1, dists);
	});

	std::vector<int> tak(n, -1), aok(n, -1);
	dfs(u, 0, tak);
	dfs(v, 0, aok);

	int ans = 0;
	for (int i = 0; i < n; ++i)
		if (tak[i] < aok[i])
			ans = std::max(ans, aok[i]);

	std::cout << ans - 1 << std::endl;
}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#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=1e9+7;
const LL LINF=1LL<<62;
const LL INF=1<<30;


int main(){
    int N,M;
    while(cin >> N >> M){
        if(N==0&&M==0) break;
        vector<LL> s(N),d(M),ac(1<<N);
        for(int i=0;i<N;i++) cin >> s[i];
        for(int i=0;i<M;i++) cin >> d[i];
        for(int i=0;i<(1<<N);i++){
            for(int j=0;j<N;j++){
                if(i&(1<<j)) ac[i]+=s[j];
            }
        }
        sort(All(d));
        LL dp[M+1][1<<N];
        memset(dp,0,sizeof(dp));
        for(int i=1;i<M+1;i++){
            for(int j=0;j<(1<<N);j++){
                dp[i][j]=LINF;
            }
        }
        for(int m=0;m<M;m++){
            for(int k=0;k<(1<<N);k++){
                for(int s=0;s<N;s++){
                    if(k&(1<<s)) continue;
                    int p=k|(1<<s);
                    dp[m][p]=min(dp[m][p],dp[m][k]);
                }
                dp[m+1][k]=min(dp[m+1][k],dp[m][k]+abs(ac[k]-d[m]));
            }
        }
        LL ans=LINF;
        for(int k=0;k<(1<<N);k++){
            ans=min(ans,dp[M][k]);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 29248
/*
 * sto Qingyu orz
 * 感谢真神sqy无私的教诲。膜时队者处处阿克，只因大师sqy在他背后。不膜大师者违背了真神的旨意，真神必将降下天谴,
 * 使其天天爆零
 * 我不由自主地膜拜真神sqy。
 * Author: RainAir
 * Time: 2019-10-16 20:30:37
 */
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define fi first
#define se second
#define U unsigned
#define P std::pair
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 100000+5;
int k,n;
int a[MAXN];

int main(){
    scanf("%d%d",&n,&k);--k;
    FOR(i,1,n) scanf("%d",a+i);
    int ps = 0,ans = 1e9;
    FOR(i,1,n) if(a[i] == 1) ps = i;
    FOR(l,1,n){
        int r = l+k;
        if(l <= ps && ps <= r){
            ans = std::min(ans,(int)(std::ceil(1.0*(l-1)/k)+std::ceil(1.0*(n-r)/k)));
        }
    }
    printf("%d\n",ans+1);
    return 0;
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

int main() {
	ll a, b;
	cin >> a >> b;
	if (a * b <= 0) puts("Zero");
	else if (a > 0) puts("Positive");
	else {
		if ((b - a) % 2) puts("Positive");
		else puts("Negative");
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
        import java.math.BigInteger;
        import java.util.Arrays;
        import java.util.Scanner;
public class Main {
    public static int gcd(int a,int b){
        if(b==0)
            return a;
        int v=a%b;
        return gcd(b,v);
    }
    public static StreamTokenizer in;
    static {
        try{
            in = new StreamTokenizer(new BufferedReader(new InputStreamReader(new BufferedInputStream(System.in))));
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public static int nextInt() throws IOException{ in.nextToken(); return (int)in.nval; }
    public static void main(String[] args) throws IOException{
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        String a=sc.nextLine();
        String b=sc.nextLine();
        b=b.substring(0,b.length()-1);
        if(a.equals(b))
            System.out.print("Yes");
        else System.out.print("No");
    }
}


Measured memory_bytes: 35756
#include<bits/stdc++.h>
#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)
#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)
#define re(i,a,n) for(int _tmp=n,i=a;i<_tmp;++i)
#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)
#define For(i,v,u) for(int i=H[u],v=to[i];i;i=nxt[i],v=to[i])
#define si(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define X first
#define Y second
#define inf 1000000000
using namespace std;
template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}
template<class T> inline void read(T&x,T&y){read(x);read(y);}
template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}
template<class T> inline void MAX(T&x,T y){if(x<y)x=y;}
template<class T> inline void MIN(T&x,T y){if(x>y)x=y;}
typedef long long ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
const int N=111111;
//head
int n,a[N],b[N],p[N];
int main() {
	read(n);
	rep(i,1,n)a[i]=i*n,b[i]=(n+1-i)*n;
	rep(i,1,n)read(p[i]),b[p[i]]+=i-1;
	rep(i,1,n)printf("%d ",a[i]);puts("");
	rep(i,1,n)printf("%d ",b[i]);puts("");
	return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
signed main(){
  int n;
 
  while(cin>>n,n){
    int sum=0;
    int l[10]={};
    int s[10]={};
    
  while(true){
      if(n==6174){
	cout<<sum<<'\n';
	break;
      }
      for(int i=3;i>=0;i--){
	l[i]=n%10;
	s[i]=n%10;
	n/=10;
      }
      sort(s,s+4);
      sort(l,l+4,greater<int>());
      if(l[0]==s[0] && l[1]==s[1] && l[2]==s[2] && l[3]==s[3] && sum==0){
	cout<<"NA"<<'\n';
	break;
      }
      sum++;
      n=(l[0]*1000+l[1]*100+l[2]*10+l[3])-(s[0]*1000+s[1]*100+s[2]*10+s[3]);
    }
  }
  return(0);
}




Measured memory_bytes: 3168
n,m=map(int,input().split())

l=[0]*m
for i in range(n):
    ka=list(map(int,input().split()))
    A=ka[1:]
    for a in A:
        l[a-1]+=1
ans=0
for i in l:
    if i==n:
        ans+=1
print(ans)


Measured memory_bytes: 38256
# 別変数の整数複数個
X, N = [int(x) for x in input().strip().split(" ")]
if N == 0:
    P = []
else:
    P = sorted([int(x) for x in input().strip().split(" ")])

x1, x2 = X, X
while True:
    if x1 not in P:
        print(x1)
        break
    if x2 not in P:
        print(x2)
        break
    x1, x2 = x1 - 1, x2 + 1


Measured memory_bytes: 9188