akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>

void Trace( int *A, int N, int cnt){
	//?????????????????????????????????N-1??¨??????
	for (int i = 0; i < N - 1; i++){
		printf("%d ", A[i]);
	}
	printf("%d\n", A[N - 1]);
	printf("%d\n", cnt);
}

int BubbleSort(int *A, int N){
	int cnt = 0;

	for (int i = 0; i < N; i++){
		for (int j = N-1; j >= i; j--){

			//??\???????????????
			if (A[j - 1] > A[j]){
				int t = A[j - 1];
				A[j - 1] = A[j];
				A[j] = t;
				cnt++;
			}
		}
	}

	return cnt;
}

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

	scanf("%d", &N);

	int *A = (int*)malloc(sizeof(int) * N);

	//??\???
	for (int i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}

	int cnt = BubbleSort(A, N);
	Trace(A, N, cnt);

	free(A);

	return 0;
}

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

using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  
  int kk;
  kk = K;
  
  int rep = 0;
  
  while(true){
    if(rep == 0){
      if(kk > N){
        break;
      }
      rep++;
    }else{
    kk = kk * K;
    if(kk > N){
      break;
    }
      rep++;
    }
  }
  
  cout << rep+1 << endl;
}

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

using ll = long long;
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> prices(m);
    vector<vector<int>> boxes_by_keys(n);
    vector<vector<int>> keys_by_boxes(m);
    for (int i = 0; i < m; i++) {
        int b;
        cin >> prices[i] >> b;
        for (int k = 0; k < b; k++) {
            int c;
            cin >> c;
            c--;
            boxes_by_keys[c].emplace_back(i);
            keys_by_boxes[i].emplace_back(c);
        }
    }
    map<string, int> mp;
    string s(n, '0');
    mp[s] = 0;
    for (int i = 0; i < m; i++) {
        vector<int> keys = keys_by_boxes[i];
        for (auto &e: mp) {
            string key = e.first;
            int p = e.second;
            bool changed = false;
            for (auto &k: keys) {
                if (key[k] == '0') {
                    key[k] = '1';
                    changed = true;
                }
            }
            if (changed) {
                p += prices[i];
            }
            if (mp.count(key)) {
                mp[key] = min(mp[key], p);
            } else {
                mp.insert({key, p});
            }
        }
    }
    string a(n, '1');
    if (mp.count(a)) {
        cout << mp[a] << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
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 T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

long long po(int x,int y){
	long long ans=1;
	for(int i=0;i<y;i++)ans*=x;
	return ans;
}
int main(){
    int N,p;
    int a[60];
    cin>>N>>p;
    REP(i,N) cin>>a[i];
    bool flag=true;
    REP(i,N) {
        if(a[i]%2!=0){
            flag=false;
            break;
        } 
    }
    ll cnt=1;
   // cout<<v.size()<<w.size()<<pow(2,0)<<endl;
    if(!flag){
   cnt=po(2,N-1);
    cout<<cnt<<endl;
    }
    else {
        if(p==0) cout<<po(2,N)<<endl;
        else cout<<0<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
/*
use under a[i][j]!=0 -> abs(i-j)<=B
(??????+-B?????????????????????????????????)
??????????????????swap?????±?????§,-B~+2B?????§???3B+1??????vi??????????????£??????
?????????0????????????B-th value(0-indexed) ???a[i][i]??????????????????????????????
time O(NB^2)
space O(NB)
*/
typedef long long ll;
ll mod=1e9+7;
typedef vector<ll> vi;
typedef vector<vi> bmat;
ll ex(ll x,ll p){
	ll a=1;
	while(p){
		if(p%2) a=a*x%mod;
		x=x*x%mod;
		p/=2;
	}
	return a;
}
ll inv(ll a){
	return ex(a,mod-2);
}
ll det(bmat a){
	int N=a.size();
	if(N==0) return 1;
	int B=a[0].size()/3;
	ll ans=1;
	rep(i,N){
		if(a[i][B]==0){
			for(int j=i+1;j<N;j++){
				if(B-(j-i)<0) break;
				if(a[j][B-(j-i)]!=0){
					int d=j-i;
					for(int k=d;k<=2*B+d;k++){
						swap(a[i][k],a[j][k-d]);
					}
					ans*=-1;
					break;
				}
			}
			if(a[i][B]==0) return 0;
		}
		for(int j=i+1;j<N;j++){
			if(B-(j-i)<0) break;
			int d=j-i;
			ll c=a[j][B-d]*inv(a[i][B])%mod;
			for(int k=B;k<=3*B;k++){
				a[j][k-d]=(a[j][k-d]-c*a[i][k])%mod;
			}
		}
		ans=ans*a[i][B]%mod;
	}
	if(ans<0) ans+=mod;
	return ans;
}
int H,W;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
string s[500];
bool is(int x,int y){
	return 0<=x&&x<H&&0<=y&&y<W&&s[x][y]=='.';
}
int n[500][15];
int main(){
	int tt=0;
	while(true){
		tt++;
		cin>>H>>W;
		if(H==0) break;
		rep(i,H) cin>>s[i];
		int N=0;
		rep(i,H) rep(j,W){
			if(s[i][j]=='#') n[i][j]=-1;
			else n[i][j]=N++;
		}
		bmat a(N-1,vi(3*W+1,0));
		rep(i,H) rep(j,W){
			if(!is(i,j)) continue;
			if(n[i][j]==N-1) break;
			rep(d,4){
				int x=i+dx[d],y=j+dy[d];
				if(!is(x,y)) continue;
				if(n[x][y]!=N-1) a[n[i][j]][n[x][y]-n[i][j]+W]++;
				a[n[i][j]][W]++;
			}
		}
		cout<<"Case "<<tt<<": "<<det(a)<<endl;
	}
}

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

int main() {
  int N, M, B=0, P=0;
  cin >> N;
  
  vector<string> vec1(N), vec2(M);
  
  for(int i=0;i<N;i++){
    cin >> vec1.at(i);
  }
  
  cin >> M;
  for(int i=0;i<M;i++){
    cin >> vec2.at(i);
  }
  
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(vec1.at(i)==vec1.at(j)){
        B++;
      }
    }
    for(int k=0;k<M;k++){
      if(vec1.at(i)==vec2.at(k)){
        B--;
      }
    }
    if(B>P){
      P=B;
    }
    B=0;
  }
  for(int l=0;l<N;l++){
    for(int j=0;j<N;j++){
      if(vec1.at(l)==vec1.at(j)){
        B++;
      }
    }
    for(int k=0;k<M;k++){
      if(vec1.at(l)==vec2.at(k)){
        B--;
      }
    }
    if(B>P){
      P=B;
    }
    B=0;
  }
  cout << P << endl;
}


Measured memory_bytes: 512
from operator import itemgetter
n=int(input())
ab=[list(map(int,input().split())) for i in range(n)]
ab=sorted(ab, key=itemgetter(1,0))
#print(ab)

time=0
for todotime,deadline in ab:
    time += todotime
    if not (time <= deadline) :
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 67924
n,k = map(int,input().split())
a = list(map(int,input().split()))
import math
l = 0
r = max(a)+1
for _ in range(100):
  m = (l+r)/2
  kn = 0
  for i in a:
    kn += i//m
  if kn > k:
    l = m
  else:
    r = m
print(math.ceil(l))

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

int main()
{
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    vector<vector<int>> a(H, vector<int>(W));
    rep(i, h) rep(j, W) a[i][j] = 1;
    rep(i, H) rep(j, w) a[i][j] = 1;
    int ans = 0;
    rep(i, H) rep(j, W) if (a[i][j] == 0) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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;}
int const INF = 1001001001;


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

int N,Q;
string S;
cin >> N >> Q >> S;

vi ok(N,0);
rep(i,N-1) if(S[i] == 'A' && S[i+1] == 'C') ok[i] = 1;

vi sum(N+1,0);
rep(i,N) sum[i+1] = sum[i] + ok[i];

while(Q--) {
    int l,r;
    cin >> l >> r;
    l--;r--;
    cout << sum[r] - sum[l] << endl;
}

return 0;
}

Measured memory_bytes: 1872
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def arrp(a) a.each{|aa|p aa} end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
s = gets.chomp
t = gets.chomp
s.size.times do
  s = s[-1] + s[0...(s.size-1)]
  if(s == t)
    puts "Yes"
    exit
  end
end
puts "No"

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

int main() {
	int n;
	cin >> n;
	if (n == 25)cout << "Christmas" << endl;
	else if (n == 24)cout << "Christmas Eve" << endl;
	else if (n == 23)cout << "Christmas Eve Eve" << endl;
	else if (n == 22)cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }

const ll INF=(1LL<<60);
const int mod=1000000007;

int N;

int dfs(string s){
    if(stol(s)>N) return 0;

    int ret=0;
    if(count(s.begin(), s.end(), '7')>=1 && count(s.begin(), s.end(), '5')>=1 && count(s.begin(), s.end(), '3')>=1){
        ret=1;
    }

    ret+=dfs(s+'7');
    ret+=dfs(s+'5');
    ret+=dfs(s+'3');

    return ret;
}



int main(void){
    cin >> N;

    cout << dfs("0") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  rep(i,3){
    if(s[i]==s[i+1]){cout<<"Bad"<<endl;return 0;}
  }
  cout<<"Good"<<endl;

  return 0;
}


Measured memory_bytes: 256
import sys
from fractions import *

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
if n % 2 == 1:
    print(0)
else:
    n=n//2
    ans = 0
    while n//5 >0:
        ans += n//5
        n = n // 5
    print(ans)


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

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    for (int i = 0;i<N;i++)
        cin >> h[i];

    vector<int> dp(N);
    long long candidate = 1e9;
    // Base cases
    dp[0] = 0;
    int offset = K - 1;
    for (int i = 1; i < N;i++)
    {
        for (int k = 1; k <= K - offset; k++)
        {
            if (candidate > dp[i - k] + abs(h[i] - h[i - k]))
                candidate = dp[i - k] + abs(h[i] - h[i - k]);
        }
        dp[i] = candidate;
        candidate = 1e9;
        if (offset > 0)
            offset--;
    }

    cout << dp[N - 1];
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int res = 0;
	string buffer;

	while ( getline( cin, buffer ) )
	{
		for ( unsigned int i = 0; i < buffer.length(); i++ )
		{
			if ( isdigit( buffer[i] ) )
			{
				continue;
			}
			else
			{
				buffer[i] = ' ';
			}
		}

		int num;
		istringstream iss( buffer );

		while ( iss >> num )
		{
			res += num;
		}
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 0
#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);
	ll n, k;
	cin >> n >> k;
	vi v(n);
	REP(i, n) cin >> v[i];
	if (n == 1) {
		if (k & 1) cout << v[0] << endl;
		return 0;
	}
	vvi pos(2e5 + 1);
	REP(i, n) {
		pos[v[i]].push_back(i);
	}
	int p = 0, cnt = 0, t = -1, s = -1;
	vector<pii> tim;
	tim.push_back({0, 0});
	set<int> seen;
	seen.insert(0);
	bool flag = true;
	while (flag) {
		if (p == 0 && cnt > 0) {
			s = cnt;
			break;
		}
		int c = upper_bound(ALL(pos[v[p]]), p) - pos[v[p]].begin();
		if (c == pos[v[p]].size()) {
			p = pos[v[p]][0] + n + 1;
		} else {
			p = pos[v[p]][c] + 1;
		}
		while (p >= n) {
			p -= n;
			cnt++;
		}
		if (seen.count(p)) {
			REP(i, tim.size()) {
				if (tim[i].second == p) {
					t = i;
					s = cnt - tim[i].first;
					goto end;
				}
			}
		}
		seen.insert(p);
		tim.push_back({cnt, p});
	}
end:;

	vi ans;
	if (k <= tim[t].first) {
		int p = -1, num = -1;
		REP(i, t) {
			if (tim[i].first < k) {
				num = tim[i].first;
				p = tim[i].second;
			}
		}
		while (num < k) {
			int c = upper_bound(ALL(pos[v[p]]), p) - pos[v[p]].begin();
			if (c == pos[v[p]].size()) {
				if (num + 1 == k) {
					ans.push_back(v[p]);
					p++;
				} else {
					p = n + pos[v[p]][c] + 1;
				}
			} else {
				p = pos[v[p]][c] + 1;
			}
			while (p >= n) {
				p -= n;
				num++;
			}
		}
	} else {
		k -= tim[t].first;
		k -= (k - 1) / s * s;
		int p = -1, num = -1;
		FOR(i, t, tim.size()) {
			if (tim[i].first - tim[t].first < k) {
				num = tim[i].first - tim[t].first;
				p = tim[i].second;
			}
		}
		while (num < k) {
			int c = upper_bound(ALL(pos[v[p]]), p) - pos[v[p]].begin();
			if (c == pos[v[p]].size()) {
				if (num + 1 == k) {
					ans.push_back(v[p]);
					p++;
				} else {
					p = n + pos[v[p]][c] + 1;
				}
			} else {
				p = pos[v[p]][c] + 1;
			}
			while (p >= n) {
				p -= n;
				num++;
			}
		}
	}
	REP(i, ans.size()) {
		cout << ans[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 25968
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define REPR(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define all(v) v.begin(), v.end()
typedef pair<int,int> pii;
#define fi first
#define se second
#define mp make_pair
typedef long long ll;

int n;
int q;
int a[1000100];

bool binarySearch(int a[], int n, int key){
  int l = 0;
  int r = n;
  while(l<r){
    int m = (l+r)/2;
    if(a[m] == key) return true;
    else if(a[m] < key) l = m+1;
    else if(a[m] > key) r = m; 
  }
  return false;
}

int main(){
  scanf("%d", &n);
  rep(i, n) scanf("%d", &a[i]);
  
  scanf("%d", &q);
  int cnt = 0;
  rep(i, q){
    int key;
    scanf("%d", &key);
    if(binarySearch(a, n, key)) cnt++;
  }

  printf("%d\n", cnt);

  return 0;
}




Measured memory_bytes: 3584
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<string> vs;

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



int main(){
	ll w, a, b, min, max;
	cin >> w >> a >> b ;
	min = MIN(a, b); 
	max = MAX(a, b);
	if ((min + w) >= max) cout << 0 << endl;
	else cout << max - (min + w) << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define MAX ((int)(1e7))
#define pi (2*acos(0))
#define M ((int)(1e9 + 7))
#define NN ((int)(5e5+2))
#define N ((int)(2e5 + 5))
#define eps 0
#define log 20
#define MOD 998244353


using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef unsigned long long int lu;

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

int main()
{
    ll n, a, b, c , d;
    scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d);
    n -= 1;
    for(int i = 0; i<=n; i++){
        ll l = a - i*d + (n-i)*c;
        ll r = l+n*(d-c);
        if(l<=b && r>=b){
            printf("YES\n");
            return 0;
        }
    }
    printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x;
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

ll N, a[100];

void build(ll x) {
	a[0] = 2, a[1] = 1;
	repi(i, 2, x + 1) {
		a[i] = a[i - 1] + a[i - 2];
	}
	return;
}

int main() {
	rd(N);
	if (N == 1) wrln(1);
	else {
		build(N);
		wrln(a[N]);
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
S=set([0])
for i in range(N):
    T=set(S)
    s=int(input())
    for t in T:
        S.add(t+s)
S=list(S)
S.sort()
for i in S[::-1]:
    if i%10!=0:
        print(i)
        quit()
print(0)


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    rep(i, N) cin >> p[i];
    sort(p.begin(), p.end());

    int ans = 0;
    rep(i, K) ans += p[i];
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define lli long long int
using namespace std;

 
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int n, x, cnt = 1;
	
	cin >> n >> x;
	
	int a[n+5];
	a[0] = 0;
	
	for(int i = 1; i <= n; i++){
		cin >> a[i]; 
		a[i] += a[i-1];
		
		if(a[i] <= x) cnt++;
	}
	
	cout << cnt << "\n";
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double ans;
int a[200005],sum[200005];
int n,k,x,ans1,tmp;
int main(){
cin>>n>>k;
for(int i=1;i<=n;i++)
{ cin>>a[i];
sum[i]=sum[i-1]+a[i]; }
for(int i=1;i<=n-k+1;i++) 
{
if(sum[i+k-1]-sum[i-1]>=ans1)
ans1=sum[i+k-1]-sum[i-1],tmp=i;
}
for(int i=tmp;i<=tmp+k-1;i++) ans+=(1+a[i])/2.0; //ans 为 double，
printf("%.12lf",ans);
return 0;
}

Measured memory_bytes: 1792
def f(k):
    if k==1:return d
    if k==0:return 0
    if k in m:return m[k]
    s=k*d
    s=min(s,f(k//2)+a+k%2*d,f((k+1)//2)+a+-k%2*d,f(k//3)+b+k%3*d,f((k+2)//3)+b+-k%3*d,f(k//5)+c+k%5*d,f((k+4)//5)+c+-k%5*d)
    m[k]=s
    return s
for _ in range(int(input())):
    m={}
    n,a,b,c,d=map(int,input().split())
    print(f(n))

Measured memory_bytes: 10880
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]

x,y,z =  MI()
print(z,x,y)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;

typedef long long ll;
typedef pair<ll, int> LP;
typedef vector<int> V;
typedef vector<ll> LV;

const ll inf = 2e18;

struct E{
    int to, cost;
};

int n;
int m;
vector<E> g[100000];
int q;
ll ds[100000];
ll dg[100000];
LV cp, cpg;
V st[1 << 18];

void add_edge(int a, int b, int c){
    E e = {b, c};
    g[a].push_back(e);
    E f = {a, c};
    g[b].push_back(f);
}

void dijkstra(int s, ll* d){
    fill_n(d, n, inf);

    priority_queue<LP, vector<LP>, greater<LP>> q;
    d[s] = 0;
    q.push(LP(0, s));
    while(!q.empty()){
        LP v = q.top();
        q.pop();

        if(v.first > d[v.second]){
            continue;
        }

        for(E& e: g[v.second]){
            if(d[e.to] > v.first + e.cost){
                d[e.to] = v.first + e.cost;
                q.push(LP(d[e.to], e.to));
            }
        }
    }
}

void compress(ll* ds, LV& cp){
    rep(i, n){
        cp.push_back(ds[i]);
    }
    sort(cp.begin(), cp.end());
    cp.erase(unique(cp.begin(), cp.end()), cp.end());

    rep(i, n){
        ds[i] = lower_bound(cp.begin(), cp.end(), ds[i]) - cp.begin();
    }
}

void merge(V a, V b, V& c){
    int i = 0;
    int j = 0;
    while(i < a.size() || j < b.size()){
        if(i < a.size()){
            if(j < b.size() && a[i] > b[j]){
                c.push_back(b[j++]);
            }
            else{
                c.push_back(a[i++]);
            }
        }
        else{
            c.push_back(b[j++]);
        }
    }
}

void init1(){
    rep(i, n){
        st[(1 << 17) + ds[i] - 1].push_back(dg[i]);
    }
    rep(i, n){
        sort(st[(1 << 17) + i - 1].begin(), st[(1 << 17) + i - 1].end());
    }
}

V init2(int l = 0, int r = 1 << 17, int k = 0){
    if(r - l == 1){
        return st[k];
    }
    merge(init2(l, (l + r) / 2, 2 * k + 1), init2((l + r) / 2, r, 2 * k + 2), st[k]);
    return st[k];
}

int count_dj(int fs, int fg, int l = 0, int r = 1 << 17, int k = 0){
    if(fs <= l){
        return 0;
    }

    if(r <= fs){
        return st[k].end() - lower_bound(st[k].begin(), st[k].end(), fg);
    }

    int m = (l + r) / 2;
    int p = count_dj(fs, fg, l, m, 2 * k + 1);
    int q = count_dj(fs, fg, m, r, 2 * k + 2);
    return p + q;
}

int main(){
    cin >> n >> m;
    rep(i, m){
        int a, b, c;
        cin >> a >> b >> c;
        add_edge(a, b, c);
    }

    dijkstra(0, ds);
    dijkstra(n - 1, dg);

    compress(ds, cp);
    compress(dg, cpg);

    init1();
    init2();

    cin >> q;
    rep(i, q){
        ll fs, fg;
        cin >> fs >> fg;
        fs = upper_bound(cp.begin(), cp.end(), fs) - cp.begin();
        fg = lower_bound(cpg.begin(), cpg.end(), fg) - cpg.begin();
        cout << count_dj(fs, fg) << endl;
    }
    return 0;
}

Measured memory_bytes: 33844
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

S = input()
N = len(S)

def dfs(i, f):
    # 列挙して末端で数字に変換
    if i == N - 1:
        return sum(list(map(int, f.split("+"))))
    return dfs(i + 1, f + S[i + 1]) + dfs(i + 1, f + "+" + S[i + 1])
print(dfs(0, S[0]))

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

int main() {
    int n;
    cin >> n;
    int h = 0;
    for (int i = n; i > 0; i /= 10) h += i % 10;
    cout << (n % h == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
using namespace std;
typedef pair<int, int>p;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int ans = 0;
	int num[4] = { 0 };
	string tmp;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		if (tmp[tmp.length() - 1]=='A'&&tmp[0] != 'B')num[0] += 1;
		if (tmp[0] == 'B'&&tmp[tmp.length() - 1] != 'A')num[1] += 1;
		if (tmp[0] == 'B'&&tmp[tmp.length() - 1]=='A')num[2] += 1;
		for (int j = 0; j < tmp.length() - 1; j++) {
			if (tmp[j] == 'A'&&tmp[j+1] == 'B')ans += 1;
		}
	}
	ans +=max(0,num[2]-1);
	if (num[0] > 0&&num[2]>0) {
		ans += 1;
		num[0] -= 1;
	}
	if (num[1] > 0&&num[2]>0) {
		ans += 1;
		num[1] -= 1;
	}
	ans += min(num[1], num[0]);
	cout << ans;
}

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

int main()
{
  int n;
  cin >> n;
  for(int x = 1; x < 10; ++x)
  {
    for (int y = 1; y < 10; ++y)
    {
      if(x * y == n)
      {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

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

int main(void){
  int c[3][3];
  for(int i=0;i<3;++i){
    for(int j=0;j<3;++j){
      cin >> c[i][j];
    }
  }
  int flg=0;
  for(int i=0;i<=c[0][0];++i){
    for(int j=0;j<=c[1][0];++j){
      for(int k=0;k<=c[2][0];++k){
        int flgs[3];
        for(int x=0;x<3;++x){
          int b1, b2, b3;
          b1 = c[0][x]-i;
          b2 = c[1][x]-j;
          b3 = c[2][x]-k;
          if(b1==b2 && b1==b3) flgs[x] = 1;
          else flgs[x] = 0;
        }
        if(flgs[0]&&flgs[1]&&flgs[2]){
          flg = 1;
        }
      }
    }
  }
  if(flg) cout << "Yes\n";
  else cout << "No\n";
}

Measured memory_bytes: 256
str = gets.chomp
opnum = gets.to_i

opnum.times do
    opary = gets.chomp.split
    a, b = opary[1].to_i, opary[2].to_i

    case opary[0]
    when "print"
        puts str[a..b]
    when "reverse"
        str[a..b] = str[a..b].reverse
    when "replace"
        str[a..b] = opary[3]
    end
end

Measured memory_bytes: 6144
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {

	int x;
	cin >> x;
	YES(x == 3 ||x==5||x==7);

	please AC;
}

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

int main(){
  int N;
  string S;
  cin>>N>>S;
  int count=0;
  for(int i=0; i<N-2; i++){
    if(S.substr(i,3)=="ABC") count++;
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
from functools import reduce
# python > pypy
MOD = 10**9 + 7
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

def gcd_list(numbers):
    return reduce(gcd, numbers)

def lcm_list(numbers):
    return reduce(lcm, numbers)

n = int(input())
a = list(map(int, input().split()))

lcm_ = lcm_list(a)
b = list(map(lambda x: lcm_//x, a))
ans = 0
for i in range(len(b)):
    ans += b[i]
print(ans% MOD)


Measured memory_bytes: 263140
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int r = 700;
	if(s[0]=='o')r+=100;
	if(s[1]=='o')r+=100;
	if(s[2]=='o')r+=100;
	cout<<r<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(elem) for elem in input().split()]
b = [int(elem) for elem in input().split()]
c = [int(elem) for elem in input().split()]

res = 0
prev_i = -1
for i in a:
  res += b[i-1]
  if prev_i + 1 == i:
    res += c[prev_i-1]
  prev_i = i
    
print(res)
    

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
map<int, int> mp;
inline void divisor(int n)
{
	for (int i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			mp[i] = !mp[i];
			if (i * i != n)	mp[n / i] = !mp[n / i];
		}
	}
}
int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int num = 0;
	vector<bool> ball(n, false);
	vector<int> ans;
	for (int i = n - 1; i >= 0; --i) {
		ball[i] = a[i];
		int sum = 0;
		for (int j = 2*(i + 1); j <= n; j += i + 1) {
			sum += ball[j - 1];
		}
		if (sum % 2 == 1)	ball[i] = !ball[i];
		if (ball[i]) {
			num++;
			ans.push_back(i + 1);
		}
	}
	cout << num << endl;
	rep(i, num)	cout << ans[i] << " ";
	return 0;
}


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

int int_length(ll num)
{
    int res = 0;
    while (num > 0)
    {
        num /= 10;
        res++;
    }
    return res;
}

int main()
{
    ll n;
    cin >> n;

    int ans = 20;
    for (ll i = 1; i * i <= n; i++)
    if (n % i == 0) 
    {

        int c = max(int_length(n/i), int_length(i));
        ans = min(ans, c);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#ifdef NeverBeRed
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef TurnRed
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

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

	int n, k, s, t;
	cin >> n >> k >> s >> t;
	vector<int> a(n);
	for (auto &i : a) cin >> i;

	vector<int> b;
	for (auto &i : a)
		if ((i|t) == t && (i&s) == s)
			b.push_back(i);

	n = b.size();
	k = min(k, n);

	vector<vector<ll>> p(n+1, vector<ll>(n+1));
	for (int i = 0; i <= n; ++i)
	{
		p[i][0] = 1;
		for (int j = 1; j <= i; ++j)
			p[i][j] = p[i-1][j] + p[i-1][j-1];
	}

	vector<int> z(18), o(18);
	for (int i = 0; i < 18; ++i)
	{
		if (~s >> i & 1) z[i] = 1;
		if (t >> i & 1) o[i] = 1;
	}

//	debug(b);

	for (auto &i : p)
		partial_sum(i.begin(), i.end(), i.begin());

	ll ans = 0;
	for (int pos = 0; pos < n; ++pos)
	{
		int x = b[pos];

		int wtf = 0, g = 0;
		for (int i = 0; i < 18; ++i)
		{
			int w = x >> i & 1;
			if (w && z[i]) g |= 1 << i, wtf |= 1 << i;
			if (!w && o[i]) g |= 1 << i;
		}

//		debug(x, g, wtf);

		vector<int> dp(1 << 18);
		for (int pos2 = pos+1; pos2 < n; ++pos2)
			++dp[b[pos2] ^ wtf];

		for (int i = 0; i < 18; ++i)
			for (int j = 0; j < 1 << 18; ++j)
				if (~j >> i & 1)
					dp[j | 1 << i] += dp[j];

		for (int i = 1; i < 1 << 18; ++i)
		{
			if ((i|g) != g) continue;
			int sg = (__builtin_popcount(i) & 1) ? +1 : -1;

			int y = ((1 << 18) - 1) ^ i;
			ans += sg * p[dp[y]][min(k-1, dp[y])];
//			for (int w = 0; w < min(k, dp[y]+1); ++w)
//				ans += sg * p[dp[y]][w];
		}
	}
//	cout << ans << "\n";
	ans *= -1;
//	for (int i = 1; i <= k; ++i)
//		ans += p[n][i];
	ans += p[n][k] - 1;
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 4708
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<int> b(n);
    rep(i, n)cin >> b[i];
    vector<int> ans;
    rep(i, n){
        int mx = 0;
        rep(j, n-i){
            if(b[j] == j+1){
                mx = j+1;
            }else if(b[j] > j+1){
                cout << -1 << endl;
                return 0;
            }
        }
        if(mx == 0){
            cout << -1 << endl;
            return 0;
        }
        ans.push_back(mx);
        vector<int> c(n, 0);
        rep(j, n-i-1){
            if(j < mx-1)c[j] = b[j];
            else c[j] = b[j+1];
        }
        b = c;
    }
    rep(i, n)cout << ans[n-1-i] << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(co)co.begin(),co.end()
int main()
{
  int n; cin >> n;
  vector<vector<int>> table(3, vector<int>(n));
  vector<int> score(n);
  rep(i,n)rep(j,3)cin>>table[j][i];
  rep(j,3)rep(i,n)
  {
    if(count(all(table[j]), table[j][i]) == 1)score[i]+=table[j][i];
  }
  rep(i,n)cout<<score[i]<<endl;
  return 0;
}

Measured memory_bytes: 1216
#include <iostream>
using namespace std;
void check(int a[], int b[], int *hit, int *blow, int n){
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(a[i] == b[j]){
				if(i==j) (*hit)++;
				else (*blow)++;
			}
			
		}
	}
}

	

int main(void)
{
	int a[4];
	int b[4];
	while(cin>>a[0]){
		for(int i=1; i<4; i++){
			cin >> a[i];
		}
		for(int i=0; i<4; i++){
			cin >> b[i];
		}
		int hit = 0;
		int blow = 0;
		check(a,b,&hit,&blow,4);
		cout << hit << " " << blow << endl;
	}	
	return 0;
}

Measured memory_bytes: 0
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,i,j;
            cin>>n;
            ll ar[n+1];
            for(i=1;i<=n;++i)
                cin>>ar[i];
            ll dp[n+1];
            dp[n]=0;
            for(i=n-1;i>=1;--i)
            {
                dp[i]=1e9;
                if(i+1<=n)
                    dp[i]=min(dp[i],abs(ar[i]-ar[i+1])+dp[i+1]);
                if(i+2<=n)
                    dp[i]=min(dp[i],abs(ar[i]-ar[i+2])+dp[i+2]);
            }
            cout<<dp[1]<<endl;
        }
        return 0;
    }


Measured memory_bytes: 1792
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 日 10/22 19:52:26 2017

*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

inline void OPEN(string s){
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

char s[10];

int main()
{
	while(~scanf("%s", s + 1)){
		int len =  strlen(s + 1);
		bool flag = false;
		for(int i = 1; i < len; i++){
			if(s[i] == 'A' && s[i + 1] == 'C') flag = true;
		}
		if(flag) printf("Yes\n");
		else printf("No\n");
	}
    return 0;
}


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

int bubbleSort(int*, int);
void printArray(int*, int);

int main(void) {
    int n, *a, i = 0, count;
    scanf("%d", &n);
    a = malloc(sizeof(int) * n);
    while (i < n) {
        scanf("%d", &a[i]);
        i++;
    }
    count = bubbleSort(a, n);
    printArray(a, n);
    printf("%d\n", count);
    return 0;
}

int bubbleSort(int *a, int n) {
    int j, w, flag = 1, count = 0;
    // flag = 1: ????????£??\????´?????????¨??????
    while (flag) {
        flag = 0;
        for (j = n - 1; j > 0;j--) {
            if (a[j] < a[j - 1]) {
                w = a[j];
                a[j] = a[j - 1];
                a[j - 1] = w;
                flag = 1;
                count++;
            }
        }
    }
    return count;
}

void printArray(int *a, int n) {
    int i = 0;
    while (i < n - 1) {
        printf("%d ", a[i]);
        i++;
    }
    printf("%d\n", a[i]);
}

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

int main(){
  string S;
  int N;
  cin >> N;
  cin >> S;

  if (N % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }else{
    rep(i,N/2){
      if (S[i] != S[i+N/2]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;

int n;

vector<vector<ll>> square(vector<vector<ll>> a) {
  vector<vector<ll>> ret(n, vector<ll>(n));
  REP(i, n) {
    REP(j, n) {
      ll sum = 0;
      REP(k, n) {
        sum += a[i][k] * a[k][j];
        sum %= MOD;
      }
      ret[i][j] = sum;
    }
  }
  return ret;
}

vector<vector<ll>> mult(vector<vector<ll>> a, vector<vector<ll>> b) {
  vector<vector<ll>> ret(n, vector<ll>(n));
  REP(i, n) {
    REP(j, n) {
      ll sum = 0;
      REP(k, n) {
        sum += a[i][k] * b[k][j];
        sum %= MOD;
      }
      ret[i][j] = sum;
    }
  }
  return ret;
}

void solve(istream& cin, ostream& cout) {
  ll k;
  cin >> n >> k;
  vector<vector<ll>> a(n, vector<ll>(n));
  REP(i, n) REP(j, n) {
    cin >> a[i][j];
  }
  vector<vector<ll>> ak(n, vector<ll>(n, 0));
  REP(i, n) {
    ak[i][i] = 1;
  }
  while (k) {
    if (k & 1) {
      ak = mult(ak, a);
    }
    a = square(a);
    k >>= 1;
  }
  ll ans = 0;
  REP(i, n) REP(j, n) {
    ans += ak[i][j];
    ans %= MOD;
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


Measured memory_bytes: 384
a=[]
b=[]
for i in range(5):
    x=int(input())
    a.append(x)
    if x%10!=0:
        b.append(x%10)
ans=0
for i in range(5):
    if a[i]%10!=0:
        a[i]=(a[i]//10)*10+10
    ans+=a[i]
if b:
    print(ans-10+min(b))
else:
    print(ans)


Measured memory_bytes: 38256
#include <stdio.h>
int main(void){
    // Your code here!
    int slot[3]={},N,P,A,B,min;
    scanf("%d",&N);
    scanf("%d %d",&A,&B);
    for(int i = 0; i < N; i++)
    {
        scanf("%d",&P);
        if(P <= A)  
            slot[0]++;
        else if(P <= B)
            slot[1]++;
        else
            slot[2]++;
    }
    if(slot[0] < slot[1])
    {
        if(slot[0] < slot[2])
        {
            min = slot[0];
        }
        else
        {
            min = slot[2];
        }
    }
    else
    {
        if(slot[1] < slot[2])
        {
            min = slot[1];
        }
        else
        {
            min = slot[2];
        }
    }
    printf("%d\n",min);
}


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

int main(){
	int n,a,b;cin >> n>>a>>b;
	vector<int> v(n);
	int ans1 =0;
	int ans2 =0;
	int ans3 =0;
	for(int i = 0; i < n; i++) {
		cin>>v[i];
		if (v[i] <= a){
			ans1++;
		}
		else if (v[i] > a && v[i] <= b){
			ans2 ++;
		}
		else{
			ans3++;
		}
	}
	cout << min(ans1,min(ans2,ans3)) << endl;

	return 0;
}

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

int main()
{
    int val;
    vector<int> is;
    for (int i = 0; i < 5 && scanf("%d", &val); i++) 
        is.push_back(val);

    sort(is.begin(), is.end());
    for (int i = is.size() - 1; i > 0; i--)
        cout << is[i] << " ";
    cout << is[0] << endl;
}

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

main(){
  int i, j, n, c;
  
  scanf("%d", &j);
  for(;j > 0;j--){
    scanf("%d", &n);
    if(n == 2){
      i = 1;
    }
    else if(n < 2 || (n % 2) == 0){
      i = 0;
    }
    else{
      for(i = 3;(double)i <= sqrt(n);i += 2){
        if(n % i == 0){
          i = 0;
          break;
        }
      } 
    }
    if(i != 0) c++;
  }

  printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
int main()
{
    int n,i,j,m;
    double w,sum=0;
    scanf("%d%d",&n,&m);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum=sum+a[i];
    }
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if(a[i]<a[j]){
                int temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }
        }
    }
    w=m;
    if(a[m-1]>=sum/(4*w))
    printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 1728
A, B, C = map(str, input().split())

# 文字列 A,B,Cが与えられます。これがしりとりになっているか判定してください。
# 正しいならば YES、そうでないならば NO を出力してください。

if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 8936
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#ifdef LOCAL
#define debug(x) cerr << '[' << #x << " = " << (x) << "]\n"
#else
#define debug(x)
#endif

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<ll> v(n);
	ll sum = 0, lo = 1e18, cnt = 0;
	rep(i, 0, n) {
		cin >> v[i];
		sum += abs(v[i]);
		lo = min(lo, abs(v[i]));
		(cnt += (v[i] < 0)) %= 2;
	}
	debug(sum);
	debug(lo);
	debug(cnt);
	cout << sum - (cnt == 0 ? 0 : lo * 2) << '\n';
}

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

fn main() {
    let n = read1::<usize>();
    let mut v = vec![97u8; n];
    let mut change = n - 1;
    let mut ans = v.iter().map(|&i| i as char).collect::<String>() + "\n";
    while change > 0 {
        if v[change] == (97 + change) as u8 {
            v[change] = 97;
            change -= 1;
        } else {
            v[change] += 1;
            let mut flg = true;
            let mut m = 0;
            for i in 0..n {
                let k = (v[i] - 97) as usize;
                if m < k {
                    if m + 1 != k {
                        flg = false;
                        break;
                    }
                    m = k;
                }
            }
            if flg {
                ans = ans + &(v.iter().map(|&i| i as char).collect::<String>()) + "\n";
            }
            change = n - 1;
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 5500
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <stack>
#include <queue>
using namespace std;

int main(){
    long A, B, C;
    int X, Y;
    long total = 40000000000;
    int max_num;

    cin >> A >> B >> C >> X >> Y;

    max_num = max(X, Y);

    for(int i = 0; i <= max_num; ++i){
        int xtmp = max(0, X-i);
        int ytmp = max(0, Y-i);

        long tmp = A * xtmp + B * ytmp + 2*C*i;
        total = min(tmp, total);
    }
    cout << total << endl;
}

Measured memory_bytes: 256