akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    int N,P;
    cin >> N >> P;
    vi A(N);
    in(N,A);

    ve<vl> dp(N+1,vl(2,0));
    dp[0][0] = 1;
    
    rep(i,N){
        if(A[i]%2==0){
            dp[i+1][0] = dp[i][0]*2;
            dp[i+1][1] = dp[i][1]*2;
        }else{
            dp[i+1][0] = dp[i][1]+dp[i][0];
            dp[i+1][1] = dp[i][1]+dp[i][0];
            
        }
    }
    
    cout << dp[N][P] << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>

using namespace std;

int father[12];

int getroot(int a){
  if(father[a]!=-1)
    return father[a]=getroot(father[a]);
  return a;
}

void union_sets(int x,int y){
  int x_root=getroot(x);
  int y_root=getroot(y);
  if(x_root!=y_root)
    father[y_root]=x_root;
}

bool query(int x,int y){
  int x_root=getroot(x);
  int y_root=getroot(y);
  return x_root==y_root;
}

int main(){
  int x=0,y=0;
  memset(father,-1,sizeof(father));
  union_sets(1,3);
  union_sets(1,5);
  union_sets(1,7);
  union_sets(1,8);
  union_sets(1,10);
  union_sets(1,12);
  union_sets(4,6);
  union_sets(4,9);
  union_sets(4,11);
  cin>>x>>y;
  if(query(x,y))
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b,c,d,e;
    cin>>a>>b>>c>>d;
    if(a>=b){
        e= e+b;
    }
        else{
        e= e+a;
        }
        if(c>=d){
        e= e+d;
    }
        else{
        e= e+c;
    }
    cout<<e<<endl;
}

Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = map(int,input().split())

U = UnionFind(n)
for i in range(m):
    a,b = map(int,input().split())
    U.union(a-1,b-1)
ans = U.group_count() - 1
print(ans)

Measured memory_bytes: 75440
// Ala be zekrellah tatmaenolgholoob ...
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define F first
#define S second
#define MP make_pair
const int maxn = 1e5+9;
const ll mod = 1e9+7;

int n;
int a[105];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	double sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sum /= n;
	int res = -1;
	for (int i = 0; i < n; i++)
		if (res == -1 || abs(sum - a[res]) > abs(sum - a[i]))
			res = i;
	cout << res << "\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 1e5+1;
int a, b, c;
map<char,int>fr;
int main(){
 //   freopen("read.txt","r",stdin);
    int n ; 
    string s ;
    cin >> n >> s;
    for(int i = 0 ; i < n ; ++i)++fr[s[i]];
    if(fr['R'] > fr['B'])puts("Yes");
    else puts("No");
  
 	return 0;	
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    
    ll a;
    double b;
    cin>>a>>b;
    ll n=(ll)(b*100 + 0.5);
    ll ans = a*n;
    cout<<ans/100<<endl;

    return 0;
    
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define quick                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);
#define time cerr << (0.1 * clock()) / CLOCKS_PER_SEC << endl;
#define mod 1000000007
typedef long long ll;
typedef pair<ll, ll> pl;
#define forn(n) for (ll i = 0; i < ll(n); i++)

void solve() {
    string s, t;
    cin >> s;
    cin >> t;
    int ans = t.length();
    for (int i = 0; i < s.length() - t.length() + 1; ++i) {
        int curr = 0;
        for (int j = i; j < i + t.length(); ++j) {
            curr += (s[j] != t[j - i]);
        }
        ans = min(ans, curr);
    }
    int curr = 0;
    for (int i = 0; i < min(s.length(), t.length()); ++i) {
        curr += (s[i] != t[i]);
    }
    ans = min(ans, curr);
    cout << ans << '\n';
}

int main() {
    quick;
    solve();
    // ll t;
    // cin >> t;
    // while (t--) {
    //     solve();
    // }
}

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

int pow(int a, int b) {
  int result = 1;
  for (int i = 0; i < b; i++) result *= a;
  return result;
}

int main() {
  int A, B, C; cin >> A >> B >> C;
  int K; cin >> K;

  string result = "No";
  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K-i; j++) {
      if (A*pow(2, i) < B*pow(2, j) && B*pow(2, j) < C*pow(2, K-i-j)) {
        result = "Yes";
        //cout << i << ' ' << j << endl;
      }
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


inline void solve(){

  int r,d,x;

  cin >> r >> d >> x;

  FOR(i,10){
    
    cout << r*x - d fin;
    x = r*x - d ;
  }
  

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 256
//Subarray Sum

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n,k,s;cin>>n>>k>>s;
    rep(i,0,k){
        cout<<s<<nnn;
    }
    rep(i,0,n-k){
        cout<<s/2+100<<nnn;
    }
    return 0;
}

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

int main()
{
    int n, k, h, ans = 0;
    std::cin >> n >> k;

    for (int i = 0; i < n; i++)
    {
        std::cin >> h;
        if (h >= k) { ans++; }
    }

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

Measured memory_bytes: 256
//What is love?

#include <iostream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define FOR(i,n,m) for(int i=n; i<m; i++)
#define ROF(i,n,m) for(int i=n; i>m; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define ri(a) scanf("%d",&a)
#define rii(a,b) scanf("%d %d",&a,&b)
#define riii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define lri(a) scanf("%lld",&a)
#define lrii(a,b) scanf("%lld %lld",&a,&b)
#define ms(obj,val) memset(obj,val,sizeof(obj))
#define debug true
#define dprintf debug && printf
#define all(v) v.begin(),v.end()

const int INF = 0x3f3f3f3f;
const ll INFLL = 1e18;
const int MOD = 1e9+7;
const int MAXN = 2e5+5;


/*--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------*/

string s;

int main(){

    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);

    cin >> s;

    int n = s.size();

    int ans = 0;
    int i = 0;
    string curStr = "";

    while(i<n){
    	
		if(curStr == s.substr(i,1)){
			curStr = s.substr(i,2);
			if(i+1 < n) ans++;
			i+=2;
		}else{
			curStr = s.substr(i,1);
			ans++;
			i++;
		}

    }

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

    return 0;
}

Measured memory_bytes: 640
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto E = M.iota.map!(_ => readln.split.map!(x => x.to!int-1).array).array;
    s = readln.split.map!(to!int);
    auto S = s[0]-1;
    auto T = s[1]-1;

    auto FF = new FordFulkerson(N, S, T);
    foreach (e; E) FF.add_edge(e[0], e[1], 1), FF.add_edge(e[1], e[0], 1);

    FF.run.writeln;

    int[] ans;
    foreach (i; 0..M) {
        int u = E[i][0];
        int v = E[i][1];
        if (FF.flow[u][v]) ans ~= i + 1;
    }

    ans.length.writeln;
    ans.each!writeln;
}


class FordFulkerson {
    int N, source, sink;
    int[][] adj;
    int[][] flow;
    bool[] used;

    this(int n, int s, int t) {
        N = n;
        source = s;
        sink = t;
        assert (s >= 0 && s < N && t >= 0 && t < N);
        adj = new int[][](N);
        flow = new int[][](N, N);
        used = new bool[](N);
    }

    void add_edge(int from, int to, int cap) {
        adj[from] ~= to;
        adj[to] ~= from;
        flow[from][to] = cap;
    }

    int dfs(int v, int min_cap) {
        if (v == sink)
            return min_cap;
        if (used[v])
            return 0;
        used[v] = true;
        foreach (to; adj[v]) {
            if (!used[to] && flow[v][to] > 0) {
                auto bottleneck = dfs(to, min(min_cap, flow[v][to]));
                if (bottleneck == 0) continue;
                flow[v][to] -= bottleneck;
                flow[to][v] += bottleneck;
                return bottleneck;
            }
        }
        return 0;
    }

    int run() {
        int ret = 0;
        while (true) {
            foreach (i; 0..N) used[i] = false;
            int f = dfs(source, int.max);
            if (f > 0)
                ret += f;
            else
                return ret;
        }
    }
}



Measured memory_bytes: 3296
#include <algorithm>
#include <climits>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define REPR(i, n) for(int i = n - 1; 0 <= i; i--)
#define FOR(i, s, e) for(int i = s; i <= e; i++)
#define FORR(i, s, e) for(int i = s; e <= i; i--)
#define LLI long long int
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

struct ST {
    string s;
    int p, c;
    ST(string _s, int _p, int _c) : s(_s), p(_p), c(_c) {}
    bool operator<(const ST &an) {
        if(s == an.s) {
            return p > an.p;
        }
        return s < an.s;
    }
};
int main() {
    int N;
    cin >> N;
    vector<ST> v;
    string s;
    int p;
    REP(i, N) {
        cin >> s >> p;
        v.push_back(ST(s, p, i + 1));
    }
    SORT(v);
    for(ST f : v) {
        cout << f.c << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>


     
#define INF 1e9
#define LINF 1e19
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define pb push_back
#define sz size()
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;

     
const ll MOD = 1e9 + 7;
const ll ZER = 0;

ll f(ll n){
    ll sum = 0;
    for(ll i = 1; i <= n; i *= 2){
        //i桁目の1の個数
        ll now = n / (2 * i) * i + max(ZER, n % (i * 2) - i);
        now %= 2;
        sum += now * i;
        //cout << now << " " << i << endl;
    }
    return sum;
}

int main(){
    ll h, w;
    cin >> h >> w;
    vector<string> s(h);
    map<char, int> mp;
    rep(i, h)cin >> s[i];
    rep(i, h){
        rep(j, w){
            mp[s[i][j]]++;
        }
    }

    ll g1 = 0, g2 = 0, g4;
    if(h * w % 2 == 1)g1 = 1;
    if(h % 2 == 1)g2 += w / 2;
    if(w % 2 == 1)g2 += h / 2;
    g4 = (h / 2) * (w / 2);
    ll cnt = 0;
    bool f = true;
    //両方偶数
    map<int, int> c;
    if(h % 2 == 0 && w % 2 == 0){
        for(auto m : mp){
            if(m.second % 4 != 0){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    //両方奇数
    if(h % 2 && w % 2){
        for(auto m : mp)c[m.second % 4]++;
        if(c[3] == 1){
            c[2]++;
            c[1]++;
        }
        if(c[1] != 1)f = false;
        if(c[2] > h / 2 + w / 2)f = false;
        cout << (f ? "Yes" : "No") << endl;
        return 0;
    }
    if(w % 2 == 0)swap(h, w);
    for(auto m : mp)c[m.second % 4]++;
    if(c[1] > 0 || c[3] > 0)f = false;
    if(c[2] > g2)f = false;
    cout << (f ? "Yes" : "No") << endl;
}





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

int main(){
  int N,Ncp;
  cin >> N >> Ncp;

  vector<int> CPs(Ncp);
  for(int i=0; i<Ncp; i++){
    cin >> CPs.at(i);
  }
  sort(CPs.begin(), CPs.end());

  vector<int> diff(Ncp- 1);
  for(int i=1; i<Ncp; i++){
    diff.at(i-1)= CPs.at(i)- CPs.at(i-1);
  }
  sort(diff.begin(), diff.end());

  int ans= 0;
  for(int i=0; i<Ncp- N; i++){
    ans+= diff.at(i);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(void)
{
  long n,d;
  int cnt=0;
  long x[250000],y[250000];
  scanf("%ld%ld", &n, &d);
    long D=d*d;
  for(int i=0;i<n;i++){
    scanf("%ld%ld", &x[i],&y[i]);
    if(D >= x[i]*x[i]+y[i]*y[i]){
      cnt++;
    }
  }
  printf("%d", cnt);
return 0;
}

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

typedef long long ll;
const int MOD = 1e9 + 7;
typedef vector<ll> vll;

int main() {
    ll n;
    cin >> n;
    vll nums(n);
    for (int i = 0; i < n; ++i) {
        cin >> nums[i];
        if (i > 0) nums[i] += nums[i - 1];
    }
    vector<pair<ll, ll>> leftMinMax(n);
    int l = 1;
    int r = 3;
    ll l1, l2, l1t, l2t;
    ll r1, r2, r1t, r2t;
    ll ans = 1e9;
    ll tmin, tmax;
    for (int middle = 2; middle < n - 1; ++middle) {
        while (l < middle - 1) {
            // if (l + 1 < middle) {
                l1 = nums[l - 1];
                l2 = nums[middle - 1] - l1;
                l1t = nums[l];
                l2t = nums[middle - 1] - l1t;
                if (abs(l1 - l2) > abs(l1t - l2t)) ++l;
                else break;
            // }
        }
        l1 = nums[l - 1];
        l2 = nums[middle - 1] - l1;
        leftMinMax[middle].first = min(l1, l2);
        leftMinMax[middle].second = max(l1, l2);
    }
    // for (int middle = 2; middle < n - 1; ++middle) {
        // cout << middle << " " << leftMinMax[middle].first << " " << leftMinMax[middle].second << endl;
    // }
    for (int middle = 2; middle < n - 1; ++middle) {
        while (r < n - 1) {
            while (r <= middle) ++r;
            // if (r + 1 < n) {
                r1 = nums[r - 1] - nums[middle - 1];
                r2 = nums[n - 1] - nums[r - 1];
                r1t = nums[r] - nums[middle - 1];
                r2t = nums[n - 1] - nums[r];
                if (abs(r1 - r2) > abs(r1t - r2t)) ++r;
                else break;
            // } else break;
        }
        r1 = nums[r - 1] - nums[middle - 1];
        r2 = nums[n - 1] - nums[r - 1];
        // cout << middle << " " << r1 << " " << r2 << endl;
        tmin = min({r1, r2, leftMinMax[middle].first});
        tmax = max({r1, r2, leftMinMax[middle].second});
        ans = min(ans, tmax - tmin);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;

int main() {
	int N,D,X,A[100]={},k=0;
	cin>>N>>D>>X;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		for(int j=1;j<=D;j+=A[i])
		{
			k++;
		}
	}
	cout<<k+X;
	}

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

int main() {
  int n,p=0;

  vector<vector<int>> a(3,vector<int>(3));
  vector<vector<int>> c(3,vector<int>(3));
  rep(i,3)
    rep(j,3){
      cin >> a[i][j];
      c[i][j]=0;
    }
  cin >> n;
  rep(k,n){
    int b;
    cin >> b;
    rep(i,3)
      rep(j,3)
        if (b==a[i][j]) c[i][j]=1;
  } 
  // rep(i,3){rep(j,3)cout << c[i][j];cout << endl;}
  if (
    ((c[0][0]==1)&&(c[0][1]==1)&&(c[0][2]==1))||
    ((c[1][0]==1)&&(c[1][1]==1)&&(c[1][2]==1))||
    ((c[2][0]==1)&&(c[2][1]==1)&&(c[2][2]==1))||
    ((c[0][0]==1)&&(c[1][0]==1)&&(c[2][0]==1))||
    ((c[0][1]==1)&&(c[1][1]==1)&&(c[2][1]==1))||
    ((c[0][2]==1)&&(c[1][2]==1)&&(c[2][2]==1))||
    ((c[0][0]==1)&&(c[1][1]==1)&&(c[2][2]==1))||
    ((c[0][2]==1)&&(c[1][1]==1)&&(c[2][0]==1))
    ) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

typedef long long ll;
const ll INF = 1000000000000000;

int main() {
  ll n;
  cin >> n;
  ll ans = INF;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0){
      ans = min(ans, i-1+n/i-1);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 888
// ?????¬???????????¬??????

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

// ?§?????????¨????????¨???????????????????¨???????????§???????
template <typename T>
struct Edge {
    int from, to;
    T cost;
    Edge(int s, T d) : to(s), cost(d) {}
    Edge(int f, int s, T d) : from(f), to(s), cost(d) {}

    bool operator<(const Edge &e) const {
        return cost < e.cost;
    }
    bool operator>(const Edge &e) const {
        return cost > e.cost;
    }
};

template <typename T>
using Graph = vector< vector< Edge<T> > >;

// Kahn????????????????????????????????¢?????´????????? (Verified: AOJ GRL_4_B: Topological Sort)
template <typename T>
vector<int> tpsort_Kahn(const vector< vector< Edge<T> > > &g) {
    const int V = g.size();
    vector<int> indeg(V, 0);
    stack<int> S;

    rep(i,0,V) rep(j,0,g[i].size())
        indeg[ g[i][j].to ]++;
    rep(i,0,V) if(indeg[i] == 0) S.push(i);

    vector<int> ans;
    while(S.size() > 0) {
        int u = S.top(); S.pop();
        ans.push_back(u);
        rep(i,0,g[u].size()) {
            indeg[ g[u][i].to ]--;
            if(indeg[ g[u][i].to ] ==  0)
                S.push( g[u][i].to );
        }
    }
    return ans;
}

signed main() {
    int N, M; cin >> N >> M;
    Graph<int> G(N);

    rep(i,0,M) {
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].push_back(Edge<int>(b, 1));
    }

    vector<int> ans = tpsort_Kahn(G);
    for(auto x : ans) cout << x + 1 << endl;
    return 0;
}

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

main()
{
    int k; cin>>k;
    string s; cin>>s;
    if(s.size()>k)
    {
        cout << s.substr(0,k)+"..." << "\n";
    }
    else
    {
        cout << s << "\n";
    }
}

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

#define tnum long long

#define loop(i,end) for(int i = 0; i < end; i++)

int main(int argc, char *argv[]) {
	int n, m;
	tnum res;

	scanf("%d %d", &n, &m);
	res = n * (n - 1) / 2 + m * (m - 1) / 2;
	printf("%lld", res);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>

int n, h[105];
int main() {
	std::cin >> n;
	for (int i = 0; i < n; ++i)
		std::cin >> h[i];

	long long ans = 0;
	int nowh = 0;
	for (int i = 0; i < n; ++i) {
		if (h[i] >= nowh) {
			ans += h[i] - nowh;
			nowh = h[i];
		}
		else
			nowh = h[i];
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  cin >> s;
  cout << s.substr(0, s.size() - 8) << endl;

  return 0;
}

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

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

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

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

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

    string S;
    cin >> S;
    vector<string> num = {"SUN", "MON", "TUE" ,"WED", "THU", "FRI", "SAT"};
    ll idx;
    REP(i, num.size()){
    	if(num[i] == S) idx = i;
    }
    cout << (7-idx) << endl;
    return 0;
}

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

#時計回り
D1 = []
for i in range(N-1):
  d = A[i+1] - A[i]
  if d < 0:
    d += K
  D1.append(d)
d = A[0] - A[-1]
if d < 0:
  d += K
D1.append(d)


#反時計回り
D2 = []
for i in range(N-1):
  d = A[i] - A[i+1]
  if d < 0:
    d += K
  D2.append(d)
d = A[-1] - A[0]
if d < 0:
  d += K
D2.append(d)

D1 = sorted(D1)
D2 = sorted(D2)

T1 = sum(D1[:-1])
T2 = sum(D2[:-1])

print(min([T1, T2]))

Measured memory_bytes: 26444
using System;
using System.Collections.Generic;

namespace ConsoleApp_CS
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = CIn.ReadLong();
            var a = CIn.ReadIntArray(n);
            var b = new long[n];
            var m = (long)0;

            for(var i = n - 1; i >= 0; i--)
            {
                var s = (long)0;
                for(var j = i+i+1; j < n; j += i+1)
                {
                    s += b[j];
                }
                if (s % 2 == a[i])
                {
                    b[i] = 0;
                }
                else
                {
                    b[i] = 1;
                    m++;
                }
            }

            Console.WriteLine(m);
            for(var i = 0; i < n; i++)
            {
                if (b[i] == 1)
                {
                    Console.Write("{0} ", i+1);
                }
            }
            Console.WriteLine();
        }
    }

    class CIn
    {
        private static readonly Queue<string> fieldBuffer = new Queue<string>();

        public static string Read()
        {
            if (fieldBuffer.Count == 0)
            {
                foreach (var field in Console.ReadLine().Split())
                {
                    fieldBuffer.Enqueue(field);
                }
            }
            return fieldBuffer.Dequeue();
        }

        public static int ReadInt() => int.Parse(Read());
        public static long ReadLong() => long.Parse(Read());
        public static double ReadDouble() => double.Parse(Read());

        public static string[] ReadStringArray(long n)
        {
            var array = new string[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = Read();
            }
            return array;
        }

        public static int[] ReadIntArray(long n)
        {
            var array = new int[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = ReadInt();
            }
            return array;
        }

        public static long[] ReadLongArray(long n)
        {
            var array = new long[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = ReadLong();
            }
            return array;
        }

        public static double[] ReadDoubleArray(long n)
        {
            var array = new double[n];
            for (var i = 0; i < n; i++)
            {
                array[i] = ReadDouble();
            }
            return array;
        }
    }
}


Measured memory_bytes: 33492
// https://abc100.contest.atcoder.jp/tasks/abc100_d
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sz(a) ((int) (a).size())
#define nl '\n'
#define sp ' '

#define MAXN 1005

int N, M;
ll A[MAXN][3], sum[MAXN];

int main() {
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> N >> M;
    for (int i = 0; i < N; i++) for (int j = 0; j < 3; j++) cin >> A[i][j];
    ll bestAns = -0x3f3f3f3f3f3f3f3f;
    for (int i = 0; i < (1 << 3); i++) {
        for (int j = 0; j < N; j++) {
            sum[j] = 0;
            for (int k = 0; k < 3; k++) if ((i >> k) & 1) sum[j] += A[j][k]; else sum[j] -= A[j][k];
        }
        sort(sum, sum + N, greater<ll>());
        ll ans = 0;
        for (int j = 0; j < M; j++) ans += sum[j];
        bestAns = max(bestAns, ans);
    }
    cout << bestAns << nl;
    return 0;
}


Measured memory_bytes: 256
import com.sun.org.apache.xpath.internal.operations.Bool
import java.lang.Math.*

const val MOD = 1000000007L

fun main(args: Array<String>) {
    val (k, x) = readLongList()

    val min = max(-1000000L, x - k + 1)
    val max = min(1000000L, x + k - 1)

    for (i in min..max) {
        print(i)
        print(" ")
    }
}

fun readList() = readLine()!!.split(' ')
fun readInt() = readLine()!!.split(' ').map(String::toInt).first()
fun readIntList() = readList().map(String::toInt)
fun readLongList() = readList().map(String::toLong)
fun readDoubleList() = readList().map(String::toDouble)

fun readPair(): Pair<String, String> {
    val splite = readLine()!!.split(' ')
    return Pair(splite[0], splite[1])
}

fun <T> List<T>.copy() = this.map { it }

inline fun <reified T> dualArray(h: Int, w: Int, init: (Int, Int) -> T) {
    Array(h) { i ->
        return@Array Array(w) { j ->
            return@Array init(i, j)
        }
    }
}

// 速度のためforEachは避ける
inline fun Int.rep(start: Int = 0, shiftLast: Boolean = false, body: (Int) -> Unit) {
    for (i in start until if (shiftLast) this + start else this) {
        body(i)
    }
}

inline fun Long.rep(start: Long = 0, shiftLast: Boolean = false, body: (Long) -> Unit) {
    for (i in start until if (shiftLast) this + start else this) {
        body(i)
    }
}

// 約数のList
fun divisor(value: Long): List<Long> {
    val max = sqrt(value.toDouble()).toLong()
    val former = mutableListOf<Long>()
    val latter = mutableListOf<Long>()
    (1..max).filter { value % it == 0L }
        .forEach {
            former.add(it)
            latter.add(value / it)
        }
    former.addAll(latter.reversed())
    return former
}

// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun prime(from: Long, to: Long = from): List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j -> i % j != 0L }
    }
}

// 素因数分解
fun decom(value: Long): List<Long> {
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}

// 最大公約数
fun gcd(a: Long, b: Long): Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

// 文字列を入れ替え
fun swap(base: String, a: String, b: String): String {
    return base.map {
        when (it) {
            a.toCharArray()[0] -> b
            b.toCharArray()[0] -> a
            else -> it.toString()
        }
    }.joinToString()
}

// 二分探索
fun List<Long>.binarySearch(target: Long, _start: Int = 0, _end: Int = this.size): Int {
    var start = (_start - 1).toLong()
    var end = _end.toLong()
    while (end - start > 1) {
        val mid = (start + end) / 2
        if (this[mid.toInt()] < target) {
            start = mid
        } else {
            end = mid
        }
    }
    return end.toInt()
}

// bit全探索
inline fun Int.bitAllSearch(body: (Array<Int>) -> Unit) {
    for (bit in 0 until (1 shl this)) {
        val s = mutableListOf<Int>()
        for (i in 0 until this) {
            if ((bit and (1 shl i)) shr i == 1) { // i が bit に入るかどうか
                s.add(i)
            }
        }
        body(s.toTypedArray())
    }
}

Measured memory_bytes: 38128
import fractions

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

N, M = [int(x) for x in input().split()]
l = [int(x) // 2 for x in input().split()]
ans = l[0]
for i in reversed(range(30)):
  if ans % 2 ** i == 0:
    numof2 = 2 ** i
    break
for i in range(1, N):
  if l[i] % numof2 == 0 and (l[i] // numof2) % 2 == 1: 
    ans = lcm(ans, l[i])
  else:
    ans = M + 1
    break
ans2 = M // ans
print(ans2 // 2 + ans2 % 2)

Measured memory_bytes: 16316
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
  long a,b,ab,x,y;
  cin>>a>>b>>ab>>x>>y;

  long ans = x*a + y*b;
  rep(i,max(x,y)+1){
    ans = min(ans, i*2*ab + max(0L, x-i)*a + max(0L, y-i)*b);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int main(void) {
    int red, green, blue, num;
    cin >> red >> green >> blue >> num;
    int ans = 0;
    for(int r = 0; r <= num/red; r++) {
        for(int g = 0; g <= num/green; g++) {
            int rem = num - r*red - g * green;
            if(rem < 0) continue;
            if(rem%blue) continue;
            debug("%d %d %d\n", r,g,rem/blue);
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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 dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  ll ans=0;
  ans+=n/500*1000;
  n%=500;
  ans+=n/5*5;
  COUT(ans);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	char* s = (char*)calloc(101, sizeof(char));
	cin >> s;
	bool ans_flg = true;
	for(int i = 0; s[i] != '\0'; i++){
		if((i+1) % 2 == 0){
			if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D') ans_flg = false;
		}
		else {
			if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D') ans_flg = false;
		}
	}
	cout << ((ans_flg)?"Yes":"No") << endl;
	
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int main(){
 string s,t;
  cin>>s>>t;
  int count=0;
  for(int i=0;i<s.size();i++)
  {
    if(s[i]!=t[i])
      count++;
  }
  cout<<count;
  return 0;
}

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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("d",&a,&b)
#define sfff(a,b,c)     scanf("d%d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int z=1 ; z<=t ; z++)
#define PRINT_CASE printf("Case %d: ",z)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;

int prof[maxn][4];
ll DP[maxn][4];
int n;
ll cal(int pos , int last)
{
    if(pos==n) return 0LL;

    ll &res=DP[pos][last];

    if(res!=-1){
        return res;
    }

    ll mx=0;

    for(int i=1 ; i<=3 ; i++){
        if(i!=last){
            mx=max(mx,cal(pos+1,i)+prof[pos][i]);
        }
    }

    res=mx;
    return res;

}

int main() {
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin>>n;

    for(int i=0 ; i<n ; i++)
    {
        cin>>prof[i][1]>>prof[i][2]>>prof[i][3];
    }

    memset(DP , -1 ,sizeof (DP));

    cout<<cal(0,0)<<endl;

    return 0;
}


Measured memory_bytes: 14720
#include <bits/stdc++.h>
using namespace std;
int n,k;
int a[100000];
int dp[100000];

int recur(int i){
    if(i == n-1) return 0;
    if(dp[i] != -1) return dp[i];
    else{
        dp[i] = recur(i+1) + abs(a[i] - a[i+1]);
        for(int j = 2; j <= k; j++){
            if(i + j < n) {
                dp[i] = min(dp[i], recur(i+j) + abs(a[i] - a[i+j]));
            }
        }
        return dp[i];
    }
}


int main(){
    cin>>n>>k;
    for(int i = 0 ; i < n; i++) cin>>a[i];
    memset(dp,-1,sizeof dp);
    cout<<recur(0);
}


Measured memory_bytes: 5760
#include <cstdio>
using namespace std;
int a[10000];
int get_value(int x) {
	int ret = 0;
	while ((x & 1) == 0) {
	    ret++;
	    x >>= 1;
	}
	return ret;
}
int main(int argc, char *argv[]) {
    int n, mx = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
    	scanf("%d", &a[i]);
    	mx += get_value(a[i]);
    }
    printf("%d\n", mx);
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left

N = int(input())
A = [int(input()) for _ in range(N)]

color = [-1]*N

for i in range(N):
    pos = bisect_left(color, A[i])
    color[pos-1] = A[i]

ans = len([c for c in color if c != -1])
print(ans)

Measured memory_bytes: 8604
// AtCoder AGC094 A - Same Integers
// 2020.1.22 bal4u

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

int cmp(const void *u, const void *v) { return *(int *)v - *(int *)u; }
int a[3];

int main()
{
	int i, x;
	for (i = 0; i < 3; ++i) scanf("%d", a+i);
	qsort(a, 3, sizeof(int), cmp);
	
	int ans = 0;
	x = (a[0]-a[1])/2, a[1] += 2*x, ans += x;
	x = (a[0]-a[2])/2, a[2] += 2*x, ans += x;
	if (a[1] != a[0]) {
		if (a[1] == a[2]) ans++;
		else ans += 2;
	} else {
		if (a[1] == a[2]);
		else ans += 2;
	}
	printf("%d\n", ans);
	return 0;
}


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

int main() {
	int n;
	cin >> n;
	map<int, int> mp;
	rep(i, n) {
		int a;
		cin >> a;
		mp[a]++;
	}
	int ans = 0;
	for (auto a : mp) {
		if (a.second % 2 == 1) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8028
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int total = 0;
    if(c > (a + b)) total = a + b + 1 + b;
    else total = c + b;
    cout << total << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split(' '))
dic = {i+1:0 for i in range(M)}
for i in range(N):
    lst = list(map(int, input().split(' ')))
    for a in lst[1:]:
        dic[a] += 1

cnt = 0
for v in dic.values():
    if v == N:
        cnt += 1
         
print(cnt)

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

int main()
{
  int a , b, c, d = 0, e = 0;
  
  cin >> a >> b >> c;
  
  if(b / a >= c){
    d = c;
  }else{
    d = b / a;
  } 
  cout << d << endl;
}
  
  

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

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

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

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

int main(){
	int n,p[20202]={},a[20202]={},b[20020]={};
	cin>>n;
	int d=30000,d2=500000000;
	FOR(i,0,n){
		cin>>p[i];
		p[i]--;
		int ii=i+1;
		a[i]=d*ii;
		b[i]=d*(n-i);
	}
	FOR(i,0,n){
		b[p[i]]+=i;
	}
	FOR(i,0,n)cout<<a[i]<<" ";
	cout<<endl;
	FOR(i,0,n)cout<<b[i]<<" ";
	cout<<endl;
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;
const int M = 2e6 + 5;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   if(pow < 0) return 0;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;ll c = (a * b)%mod;return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(2e6 + 7)] , inv_fac[(int)(2e6 + 7)];
void precomp_factorial(){fac[0] = 1;for(ll i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(ll i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};


int main()
{
    vector <int> vec(3);
    for(int i = 0; i < 3; i++) cin >> vec[i];
    sort(vec.begin(), vec.end());
    
    cout << (vec[2] - vec[0]);
}


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

int main(){
    int n, a, i, c = 0, co = 0;
    int color[8] = {};
    cin >> n;
    for(i=0; i<n; i++){
        cin >> a;
        if(a < 3200){
            color[a/400] = 1;
        }else{
            co++;
        }
    }
    for(i=0; i<8; i++){
        c += color[i];
    }
    cout << max(1, c) << ' ' << c+co;
    return 0;
}

Measured memory_bytes: 256