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

int main() {
    int A,B,C;
    cin >> A >> B >> C;
    if(A == B && A != C) {
        cout << "Yes" <<endl;
    }
    else if(A == C && A != B) {
        cout << "Yes" <<endl;
    }
    else if(B == C && A != B) {
        cout << "Yes" <<endl;
    }
    else cout << "No" <<endl;
}

Measured memory_bytes: 384
def main():
    N = int(input())
    v_list = list(map(int, input().split()))
    v_sorted_list = sorted(v_list)
    value = v_sorted_list[0]
    for v in sorted(v_list):
        value = (value + v) / 2

    print(value)


if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;

int main() {
  int A, B, K, c, r;
  cin >> A >> B >> K;
  c = __gcd(A, B);

  vector<int> v;
  for(int i = 1; i<=c; i++){
    if(c%i==0){
      v.push_back(i);
    }
  }
  cout << v[v.size()-K];
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int64_t N;
  cin>>N;
  for(int64_t i=sqrt(N);i>0;i--){
    if(N%i==0){
      cout<<(int)log10(i>N/i?i:N/i)+1<<endl;
      break;
    }
  }
}

Measured memory_bytes: 512
N, A, B, C = map(int,input().split(' '))
l = []
for i in range(N):
    l.append(int(input()))
#print(l)
def baseN(nums,base,maxketa):
    ans = ""
    for i in range(maxketa-1,-1,-1):
        ans+=str(nums//pow(base,i))
        nums=nums%pow(base,i)
        #print(i,ans,nums)
    return(ans)

#print(baseN(1021,2,10))
#print(baseN(pow(4,N)-1,4,N))
allsel=[]
for i in range(pow(4,N)):
    allsel.append(baseN(i,4,N))

mincost=3*1000
for key in allsel:
    #print(key)
    a0=[]
    b1=[]
    c2=[]
    x3=[]

    for i in range(len(key)):
        if key[i] == '0':
            a0.append(l[i])
        elif key[i] == '1':
            b1.append(l[i])
        elif key[i] == '2':
            c2.append(l[i])
        else:
            x3.append(l[i])
    #print(key,a0,b1,c2,x3)     
    costA = abs(sum(a0)-A)+10*(len(a0)-1)
    costB = abs(sum(b1)-B)+10*(len(b1)-1)
    costC = abs(sum(c2)-C)+10*(len(c2)-1)
    if len(a0) >= 1 and len(b1) >= 1 and len(c2) >= 1 :
        #print(a0,b1,c2,costA,costB,costC)
        mincost=min(mincost,costA+costB+costC)

print(mincost)

Measured memory_bytes: 7848
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace std;

typedef long long i64;
const int inf = (int)1.05e9;


int get_ma(int n)
{
	int s = 0;

	for(int i = 1; i <= n; ++i) {
		s += i;
		if(s >= n)
			return i;
	}

	return n;
}


int main()
{
	int n;

	scanf("%d", &n);

	vector<int> ans;
	int ma = get_ma(n);
	int v = n;

	for(int x = ma; x > 0; --x) {
		if(v - x >= 0) {
			v -= x;
			ans.push_back(x);
		}
	}

	for(auto t : ans) {
		printf("%d\n", t);
	}

	return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<pair<ll,ll>> a(n);
	rep(i, n) {
		int x,l;
		cin >> x >> l;
		a[i].first = x + l;
		a[i].second = x - l;
	}
	sort(a.begin(), a.end());
	int ans = 1;
	ll now = a[0].first;
	rep(i, n) {
		if (i == 0)continue;
		if (now <= a[i].second) {
			now = a[i].first;
			ans++;
		}
	}
	cout << ans << endl;
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//

ll solve(int N,int W,vi& w,vi& v){
    int w0 = w[0];
    // vi dw(N); rep(i,N) dw[i] = w[i] - w0;
    vvi dw(4, vi());
    rep(i,N){
        dw[w[i] - w0].pb(v[i]);
    }
    vi dwn(4);
    rep(i,4){
        sort(ALL(dw[i]));
        dw[i].pb(0);
        reverse(ALL(dw[i]));
        dwn[i] = dw[i].size();
        // accum
        rep(j,dwn[i]-1) {
            dw[i][j+1] += dw[i][j];
        }
#ifdef DEBUG
        cerr << i << " " << dwn[i] << " " << dw[i] << endl;
#endif
    }
    int best = 0;
    for (int a=0; a<dwn[0]; ++a)
    for (int b=0; b<dwn[1]; ++b)
    for (int c=0; c<dwn[2]; ++c)
    for (int d=0; d<dwn[3]; ++d) {
        int vsum = dw[0][a] + dw[1][b] + dw[2][c] + dw[3][d];
        ll wsum = (a*0 + b*1 + c*2 + d*3) + (ll)w0*(a+b+c+d);
        if (wsum <= W) best = max(best, vsum);
    }
    return best;
}

int main() {
    int N, W; cin >> N >> W;
    vi w(N), v(N);
    rep(i,N) cin >> w[i] >> v[i];
    cout << solve(N,W,w,v) << endl;
    return 0;
}


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

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

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

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

struct UnionFind{
  vll par;
  vll rank;
  UnionFind(ll n) : par(n), rank(n, 1){
    REP(i, n)
      par[i] = i;
  }

  ll find(ll x){
    if(par[x]==x)
      return x;
    return par[x] = find(par[x]);
  }

  void unite(ll x, ll y){
    x = find(x);
    y = find(y);
    if(x == y)
      return;

    if(rank[x] < rank[y])
      par[x] = y;
    else{
      par[y] = x;
      if(rank[x] == rank[y])
        rank[x]++;
    }
  }

  bool same(ll x, ll y){
    return find(x) == find(y);
  }

  ll size(ll x){
    return rank[x];
  }

};

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

  ll n, m;
  cin >> n >> m;

  vll p(n);
  REP(i, n){
    cin >> p[i];
    p[i]--;
  }

  vector<pll> xy(m);
  REP(i, m){
    cin >> xy[i].FI >> xy[i].SE;
    xy[i].FI--;
    xy[i].SE--;
  }

  UnionFind uf = UnionFind(n);
  REP(i, m)
    uf.unite(xy[i].FI, xy[i].SE);

  ll ans = 0;
  REP(i, n){
    if(p[i] == i || uf.same(p[i], i))
      ans++;
  }

  cout << ans << endl;

}






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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	string s;
	cin >> s;

	const int n = s.size();
	int ans = 0;
	
	rep(i,n){
		int cur = i % 2;
		if(s[i] == 'p') cur--;
		ans += cur; 
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
arr = []
n=1
i=0
loop do
  arr.push(gets.chomp.to_i)
  if arr[arr.size-1] == 0
    arr.pop
    arr.each {|i|
      puts 'Case '+n.to_s+': '+i.to_s
      n+=1
    }
    break
  elsif i > 10000
    break
  end
  i+=1
end

Measured memory_bytes: 8796
import sys
sys.setrecursionlimit(10**6)
from functools import lru_cache

IN = lambda:map(int, input().split())

n, m = IN()
parents = set(range(n + 1))
links = [set() for _ in range(n + 1)]

@lru_cache(maxsize=None)
def dfs(v):
    lv = links[v]
    return max(map(dfs, lv)) + 1 if lv else 0
  
for _ in range(m):
    x, y = IN()
    parents.discard(y)
    links[x].add(y)

print(max(map(dfs, parents)))

Measured memory_bytes: 344664
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

int main()
{
  ll r, g, b, n;
  cin >> r >> g >> b >> n;
  ll count = 0;

  for (ll x = 0; x <= n; x++)
  {
    for (ll y = 0; y <= n; y++)
    {
      ll tmp = n - r * x - g * y;
      if (tmp >= 0 && tmp % b == 0)
      {
        count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

const double pi = atan(1.0)*4.0;

int main()
{
	double x=0.0, y=0.0;
	double direct = pi / 2.0;
	int len, arg;
	while(scanf("%d,%d", &len, &arg), len||arg){
		x += cos(direct) * len;
		y += sin(direct) * len;
		direct -= arg/180.0*pi;
	}

	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

/**
 * B - Greedy Takahashi
 * 高橋君は A 枚、青木君は B 枚のクッキーを持っています。
 * 高橋君は以下の行動を K 回繰り返します。
 * ・もし高橋君がクッキーを 1 枚以上持っているなら、高橋君のクッキーを 1 枚食べる。
 * ・そうでなく、もし青木君がクッキーを 1 枚以上持っているなら、青木君のクッキーを 1 枚食べる。
 * ・高橋君も青木君もクッキーを持っていないなら、何もしない。
 * 高橋君と青木君が最終的に持っているクッキーの枚数をそれぞれ求めてください。
 */
public class Main {

    public static void main( String[] args ) {

        Scanner sc = new Scanner( System.in );
        // 入力値
        long a = sc.nextLong(); // 高橋君が持っているクッキーの枚数
        long b = sc.nextLong(); // 青木君が持っているクッキーの枚数
        long k = sc.nextLong(); // 高橋君が繰り返す数

        if( k <= a ) {
            System.out.println( a - k + " " + b );
        }
        else if( k <= a + b ) {
            System.out.println( "0 " + ( b - ( k - a ) ) );
        }
        else {
            System.out.println( "0 0" );
        }

        sc.close();
    }
}

Measured memory_bytes: 38788
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n;
  cin >> n;
  ll a[n];
  REP(i,n){
    cin >> a[i];
  }
  sort(a,a+n);
  reverse(a,a+n);
  ll sum_a = 0, sum_b = 0;
  REP(i,n){
    if(i%2==0){
      sum_a+=a[i];
    }else{
      sum_b+=a[i];
    }
  }
  cout << sum_a-sum_b << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;
class Plant {
public:
	string name;
	int p, a, b, c, d, e, f, s, m;
	int time, income,num;
	double effective;
	Plant(string name, int p, int a, int b, int c, int d, int e, int f, int s, int m) {
		this->name = name;
		this->p = p;
		this->a = a;
		this->b = b;
		this->c = c;
		this->d = d;
		this->e = e;
		this->f = f;
		this->s = s;
		this->m = m;

		this->time = a + b + c + d + e + (d + e)*(m - 1);
		this->num = f*m;
		this->income = num*s - p;
		this->effective = this->income / (double)time;
	}
	bool operator<(const Plant &other) {
		return (effective != other.effective ? effective > other.effective : name < other.name);
	}
};
signed main() {
	int n;
	while (cin >> n, n) {
		vector<Plant>v;
		rep(i, 0, n) {
			string l;
			int p, a, b, c, d, e, f, s, m;
			cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
			v.push_back(Plant(l, p, a, b, c, d, e, f, s, m));
		}
		sort(all(v));
		rep(i, 0, n) {
			cout << v[i].name << endl;
		}
		cout << "#" << endl;
	}
	return 0;
}

Measured memory_bytes: 3068
a=int(input())
s=input()
ans=s.count("R")*s.count("G")*s.count("B")
for i in range(a):
  for j in range(i+1,(a+i+1)//2):
    if s[i]!=s[j] and s[i]!=s[2*j-i] and s[j]!=s[2*j-i]:
      ans-=1
print(ans)

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

using namespace std;

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    int route[n+1] = {0};
    for(int i = 1; i <= m; ++i) {
        int index;
        cin >> index;
        route[index] = 1;
    }

    int counter = x;
    int sum1 = 0;
    while(counter >= 0) {
        sum1 += route[counter];
        counter--;
    }

    counter = x;
    int sum2 = 0;
    while(counter <= n) {
        sum2 += route[counter];
        counter++;
    }

    cout << min(sum1, sum2) << endl;
    return 0;
}

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

int main()
{
  int n;
  int min = 21, max = 0;
  int a, v;

  cin >> n;
  for (int i = 0; i < n; i++){
    cin >> a >> v;
    if (max < v){
      max = v;
      min = a;
    }
    else if (max == v){
      if (min > a){
        min = a;
      }
    }
  }
  cout << min << ' ' << max << endl;
  return (0);
}

Measured memory_bytes: 1160
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	b+=a;
	for(int i=0;i<60;i++){
		if(c%b<=a){
			cout << c << "\n";
			return 0;
		}
		c+=60;
	}
	cout << "-1\n";
return 0;
}

Measured memory_bytes: 1168
/*
░░░░░░░▄▀▀▀▀▀▀▀▄▄░░░░░░
░░░░░░▐░░░▄▄▄▄▄░ ▀▀▄
░░░░░▐░$░▐▀░░░░▀▀▀▀▄▀
░░░░░▌░░▐░░░░░░░░░░▄▄
░░░░▐░░░░▀▄▄▄▄▄▄▀▀▀░▄▀
░░░░▌▒░▒░▒░▒░░░▄▄▄▀▀
░░░░▌▒▒░▒▒▒▒▄▄▀▀
░░░▐░░▒▒▒▄▀▀░░░░░░░
░░░▐░▒▒▒▐░░░░░░░░░
░░░▐▒▒▒▒▌░░░░░░░░
░░░▐▒▒▒░▐░░░░░░░░░▄▀▄
░░░▐▒▒░▒▐▄▄▀▀▀▀▄▄▄▀░▌
░░░▐░▒▒░▄▄▄▄▀▀▄▄▄▄▄▀
░░▐▒▒▄▒▒▀▄▄▄▄▄▀░░░▄▌░░
░░▌▒▐░▀▀▄▄▄▄▄▄▄▀▀▀░░░░
░▐▒▒▌░░░░░░░░░░░░░ 
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#else
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    set <pair <pair <int, int>, int> > s;
    int a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    while (1)
    {
        if (s.count({{a, b}, c}))
        {
            cout << -1 << '\n';
            return 0;
        }
        if (a % 2 || b % 2 || c % 2)
        {
            cout << ans << '\n';
            return 0;
        }
        s.insert({{a, b}, c});
        int x = b / 2 + c / 2;
        int y = a / 2 + c / 2;
        int z = a/ 2 + b / 2;
        a = x, b = y, c = z;
        ans++;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int H,W;
	char a[101][101];
	bool oki[101]={},okj[101]={};
	scan(H);scan(W);
	rep(i,H){
		scan(a[i]);
	}
	rep(i,H){
		bool flag=0;
		rep(j,W){
			if(a[i][j]=='#') flag=1;
		}
		oki[i]=flag;
	}
	rep(j,W){
		bool flag=0;
		rep(i,H){
			if(a[i][j]=='#') flag=1;
		}
		okj[j]=flag;
	}
	rep(i,H){
		if(oki[i]){
			rep(j,W){
				if(okj[j]) printf("%c",a[i][j]);
			}
			kaigyo;
		}
	}
	return 0;
}


Measured memory_bytes: 256
first_line = list(map(int, input().split()))
N = first_line[0]
K = first_line[1]
rest = list(range(1, N+1))
for i in range(K):
  d = int(input())
  given = list(map(int, input().split()))
  for j in range(1, N+1):
    if j in given and j in rest:
      rest.remove(j)

print(len(rest))


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

int main() {
    int c = 1, max = 0;
    string S;
    cin >> S;
    size_t s = S.length();
    for (int i = 0; i < (int)s; i++) {
        if (S[i] != 'A' && S[i] != 'T' && S[i] != 'G' && S[i] != 'C'
            &&(S[i + 1] == 'A' || S[i + 1] == 'T' || S[i + 1] == 'G' || S[i + 1] == 'C')) {
            c = 1;
            continue;
        }
        else if ((S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C')
            &&(S[i + 1] == 'A' || S[i + 1] == 'T' || S[i + 1] == 'G' || S[i + 1] == 'C')) {
            c++;
            continue;
        }
        else if ((S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C')
                 && S[i + 1] != 'A' && S[i + 1] != 'T' && S[i + 1] != 'G' && S[i + 1] != 'C'
                 && c > max) {
            max = c;
            continue;
        }
    }
    cout << max;
        
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#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,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	int n, m;
	cin >> n >> m;
	int r1 = 0, r2 = 0;
	vector<int> a(n,0), b(n,0), p(m);
	vector<string> s(m);
	REP(i, m) {
		cin >> p[i] >> s[i];
		p[i]--;
	}
	REP(i, m) {
		if (s[i] == "AC") {
			if (b[p[i]] == 0) {
				b[p[i]] = 1;
				r1++;
				r2 += a[p[i]];
			}
		} else {
			a[p[i]]++;
		}
		
	}
	put(r1, r2);
	return 0;
}


Measured memory_bytes: 6912
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		StringBuffer st = new StringBuffer(str);
		st.reverse();
		System.out.println(st);
		
		
	}

}

Measured memory_bytes: 16852
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;
	long[] Persons;

	public void init() {
		N = 0;
		cnt = 0;
		Persons = new long[256];
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		switch (str.charAt(0)) {
		case 'M':
			Persons['M']++;
			break;
		case 'A':
			Persons['A']++;
			break;
		case 'R':
			Persons['R']++;
			break;
		case 'C':
			Persons['C']++;
			break;
		case 'H':
			Persons['H']++;
			break;
		}
		cnt++;
	}

	public void solve() {
		// System.out.println(Persons['M']);
		// System.out.println(Persons['A']);
		// System.out.println(Persons['R']);
		// System.out.println(Persons['C']);
		// System.out.println(Persons['H']);
		long ans = 0;
		ans += (Persons['M'] * Persons['A'] * Persons['R']);
		ans += (Persons['M'] * Persons['A'] * Persons['C']);
		ans += (Persons['M'] * Persons['A'] * Persons['H']);
		ans += (Persons['M'] * Persons['R'] * Persons['C']);
		ans += (Persons['M'] * Persons['R'] * Persons['H']);
		ans += (Persons['M'] * Persons['C'] * Persons['H']);
		ans += (Persons['A'] * Persons['R'] * Persons['C']);
		ans += (Persons['A'] * Persons['R'] * Persons['H']);
		ans += (Persons['A'] * Persons['C'] * Persons['H']);
		ans += (Persons['R'] * Persons['C'] * Persons['H']);
		System.out.println(ans);
	}
}


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

char maze[51][51];
int reached[51][51];
int H, W;

void dfs(int x, int y, int step = 1) {
    if(maze[y][x] != '.') return;
    if(reached[y][x] <= step) return;
    if(x < 0 || W <= x || y < 0 || H <= y) return;

    reached[y][x] = min(reached[y][x], step);

    dfs(x+1, y, step+1);
    dfs(x-1, y, step+1);
    dfs(x, y+1, step+1);
    dfs(x, y-1, step+1);
}

int main() {

    cin >> H >> W;
    int cnt = 0;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            cin >> maze[i][j];
            reached[i][j] = 1e9+1;
            if(maze[i][j] == '#') cnt++;
        }
    }
    dfs(0, 0);

    if(reached[H-1][W-1] == 1e9+1) cout << -1 << endl;
    else cout << H * W - reached[H-1][W-1] - cnt << endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  int x[N];
  int kyori[N];
  int ans=0;
  for(int i=0;i<N;i++){
    cin>>x[i];
    kyori[i]=min(x[i],abs(K-x[i]));
    int m=kyori[i]*2;
    ans+=m;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s; i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;


int main(){
    int n, cnt = 0; cin >> n;
    REP(i, n){
        int l, r; cin >> l >> r;
        cnt += r - l + 1;
    }
    cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef string str;
typedef vector<str> vst;typedef vector<ll> vll;
ll mod = 1000000007, INF = 10000000000000000;
ll gcd(ll a, ll b){if(b==0){return a;}return gcd(b, a%b);}
int main(){
  ll n,d,i,j,k,ans=0;
  cin>>n>>d;
  vector<vector<ll> > x(n,vector<ll>(d));
  
  for(i=0;i<n;i++){
    for(j=0;j<d;j++){
	   cin>>x[i][j];
    }
  }
  
  ll sum=0;
  for(i=0;i<n;i++){
	for(j=i+1;j<n;j++){
        sum=0;
      for(k=0;k<d;k++){
         sum+=pow(x[i][k]-x[j][k],2);
      }
      for(k=0;k<150;k++){
         if(sum==k*k){
           ans++;
           break;
         }
      }
    }
  }
  
  cout<<ans<<endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
	ll N;
  	cin>>N;
  	ll a[N];
  	rep(i,N) cin>>a[i];
  	ll max=0;
  	ll sum=0;
  
  	for(int i=0;i<N;i++){
     	 if(a[i]>max){
          	max=a[i]; 
         }
      	 if(a[i]<max){
          	 sum+=max-a[i];
         }
    }
  
  	cout<<sum<<endl;
}

Measured memory_bytes: 5156
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
using namespace std;

vector<string>split(string s, char delim){
  int len = s.length();
  string currStr = "";
  vector<string>retVec;
  for(int i = 0;i<len;i++){
    char ch = s[i];
    if(ch==delim){
      retVec.push_back(currStr);
      currStr = "";
    }else{
      currStr += ch;
    }
  }
  retVec.push_back(currStr);
  return retVec;
}

vector<int>strToIntVec(string s){
  int len = s.length();
  //  s = s.substr(1,len-2);
  vector<string>strVec = split(s,' ');
  vector<int>retVec;
  for(int i=0;i<strVec.size();i++){
    int el = atoi(strVec[i].c_str());
    retVec.push_back(el);
  }
  return retVec;
}

class Fruit{
public:
  int getMinCost(int n, int k, vector<int>&pVec){
    int sum = 0;
    sort(pVec.begin(),pVec.end());
    for(int i=0;i<k;i++){
      sum += pVec[i];
    }
    return sum;
  }
};

int main(int argc,const char*argv[]){
  string nkLn,pLn;
  Fruit f;
  getline(cin,nkLn);
  getline(cin,pLn);
  vector<int>nkVec = strToIntVec(nkLn);
  vector<int>pVec = strToIntVec(pLn);  
  int minC = f.getMinCost(nkVec[0],nkVec[1],pVec);
  cout<<minC<<endl;
  return 0;
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        a[i]--;
    }

    vector<int> idx(n);
    for(int i=0;i<n;i++){
        idx[a[i]] = i;
    }

    int len = 0;
    int l = 0;
    while(l<n){
        int r = l+1;
        while(r < n and idx[r-1] < idx[r]){
            r++;
        }
        len = max(len,r-l);
        l = r;
    }
    cout << n - len << endl;
}


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

string S;

bool used[27];
int ans;
vector<string> res;

void dfs(int now,string t){
    if(now==S.size()){
        ans++;
        res.push_back(t);
    }else{
        if(S[now]=='a'||used[S[now]-'a'-1]) dfs(now+1,t+S[now]);
        if(S[now]!='z'){
            if(used[S[now]-'a']);
            else{
                used[S[now]-'a']=true;
                dfs(now+1,t+(char)(S[now]+1));
                used[S[now]-'a']=false;
            }
        }
    }
}

void solve(){
    ans=0;
    res.clear();
    dfs(0,"");

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

    cout<<ans<<endl;
    if(ans<=10){
        for(int i=0;i<res.size();i++) cout<<res[i]<<endl;
    }else{
        for(int i=0;i<5;i++) cout<<res[i]<<endl;
        for(int i=res.size()-5;i<res.size();i++){
            cout<<res[i]<<endl;
        }
    }
}

int main(){
  while(1){
      cin>>S;
      if(S=="#") break;
      solve();
  }

  return 0;
}



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

int main () {
    int n, a, b;
    std::cin >> n >> a >> b;

    long long sum = 0;
    long long psum;
    for (int i = 1; i <= n; i++)
    {
        psum = 0;
        int tmp = i;
        if (n >= 10)
        {
            while(tmp > 0) {
                psum += tmp % 10;
                tmp /= 10;
            }
        }

        if(psum >= a && psum <= b) {
            sum += i;
        }
    }

    std::cout << sum << "\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
//krishrawat
 
 
//----------------------------MACROS-------------------------------------------------
#define pb insert//                                                                 |
#define eb emplace_back//                                                           |
#define ff first//                                                                  |
#define ss second//                                                                 |
typedef long long int ll;//                                                         |
typedef long double ld;//                                                           |
#define all(a) a.begin(), a.end()//                                                 |
#define show(x) cerr << #x << " is " << x << "\n"//                                 |
#define show2(x, y) cerr << #x << " " << #y << " " << x << " " << y << "\n"//       |
typedef vector<ll> vl;//                                                            |
typedef vector<vl> vvl;//                                                           |
typedef pair<ll, ll> pp;//                                                          |
typedef vector<pp> vp;//                                                            |
typedef map<pp, ll> ipi;//                                                          |
typedef map<pp, char> ipc;//                                                        |
typedef map<ll, ll> ii;//                                                           |
typedef set<ll> sl;//                                                               |
typedef multiset<ll> msl;//                                                         |
typedef map<char, ll> ci;//                                                         |
typedef set<pair<ll, ll>> sp;//                                                     |
const ll mod = 1e9 + 7;//                                                           |
const ll N = 2e5 + 1;//                                                             |
//----------------------------------------------------------------------------------



void solve()
{   
    ll n;cin>>n;
    vl v(n+1);
    vl m(n);
    for(auto &i:v) cin>>i;
    for(auto &i:m) cin>>i;
    ll ans=0;
    for(int i=0;i<n;i++){
        ll k=min(m[i],v[i]);
        v[i]=0;
        m[i]-=k;
        ll w=min(m[i],v[i+1]);
        v[i+1]-=w;
        ans+=k+w;
    }
    cout<<ans<<"\n";
}
 
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    
    ll t; t=1;
    //cin>>t;
    while(t--) solve(); return 0;
}

Measured memory_bytes: 4756
#include<stdio.h>

#define MAX 2000000
int H, A[MAX+1];

void maxHeapify(int i){
    int l, r, largest, tmp;
    l = 2 * i;
    r = 2 * i + 1;

    if(l <= H && A[l] > A[i]){
        largest = l;
    }else{
        largest = i;
    }
    if(r <= H && A[r] > A[largest]){
        largest = r;
    }

    if(largest != i){
        tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        maxHeapify(largest);
    }
}

int main(){
    int i;

    scanf("%d", &H);

    for(i=1; i<H+1; i++){
        scanf("%d", &A[i]);
    }
    
    for(i=H/2; i>0; i--){
        maxHeapify(i);
    }

    for(i=1; i<H+1; i++){
        printf(" %d", A[i]);
    }
    printf("\n");

    return 0;
}



Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    int t;
    cin>>t;
    if (t==1){
        cout<<"Hello World";
    }
    else{
        int x,y;
        cin>>x>>y;
        cout<<x+y;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        double[][] dp = new double[N+1][N+1];
        dp[0][0] = 1;
        for (int i=0;i<N;i++) {
            double p = Double.parseDouble(sc.next());
            for (int j=0;j<N+1;j++) {
                dp[i+1][j] = dp[i][j]*(1-p);
                if (j!=0) dp[i+1][j] += dp[i][j-1]*p;
            }
        }
        double ans = 0;
        for (int j=(N+1)/2;j<=N;j++) {
            ans += dp[N][j];
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 133544
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int wsum[200010], hsum[200010];

int main() {
    int N, W, H;
    cin >> N >> W >> H;
    fill(wsum, wsum + 200010, 0);
    fill(hsum, hsum + 200010, 0);
    for (int i = 0; i < N; i++) {
        int x, y, w;
        cin >> x >> y >> w;
        wsum[max(x * 2 - w * 2, 0)]++;
        wsum[min(x * 2 + w * 2 + 1, W * 2 + 1)]--;
        hsum[max(y * 2 - w * 2, 0)]++;
        hsum[min(y * 2 + w * 2 + 1, H * 2 + 1)]--;
    }
    bool ok = true;
    for (int i = 0; i <= W * 2; i++) {
        if (wsum[i] == 0) {
            ok = false;
            break;
        } else {
            wsum[i + 1] += wsum[i];
        }
    }
    bool okb = true;
    for (int i = 0; i <= H * 2; i++) {
        if (hsum[i] == 0) {
            okb = false;
            break;
        } else {
            hsum[i + 1] += hsum[i];
        }
    }
    if (ok || okb) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 4676
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;
using ll = long long;
const ll INF = 1e9;

int main() {
    int N;
    cin >> N;
    vector<ll> a(N), four(N), two(N), others(N);
    int fi = 0, ti = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if (a[i] % 4 == 0) {
            four.push_back(a[i]);
        } else if (a[i] % 2 == 0) {
            two.push_back(a[i]);
        } else {
            others.push_back(a[i]);
        }
    }

    sort(four.begin(), four.end());
    sort(two.begin(), two.end());
    sort(others.begin(), others.end());

    bool succ = true;
    if (N % 2 == 0) {
        succ = others.size() <= four.size();
    } else {
        succ = others.size() <= four.size() + 1;
    }

    cout << (succ ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 4336
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
ll INF = 1000000007;
using Graph = vector<vector<ll>>;

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する

vector<int> next_y = {-1,1,0,0};
vector<int> next_x = {0,0,-1,1};

//h : 行 w : 列
ll h, w;
vector<vector<string>> vec(h, vector<string>(w));


int main() {
    cin >> h >> w;
    vec.resize(h, vector<string>(w));
    
    ll count = 0;
    string s;
    rep(i,h){
        cin >> s;
        rep(j,w){
            vec.at(i).at(j) = s[j];
            if(vec.at(i).at(j) == "#"){
                count++;
            }
        }
    }

    //BFSの準備
    //全マスを未訪問(-1)に初期化
    vector<vector<ll>> dist(h, vector<ll>(w, -1));
    //queはpairで作る
    queue< pair<ll,ll> > que;

    //(0,0)マスからスタートとする
    dist[0][0] = 0;
    que.push(make_pair(0,0));

    while(!que.empty()){
        pair<ll,ll> now_pos = que.front();
        ll now_pos_y = now_pos.first;
        ll now_pos_x = now_pos.second;
        que.pop();

        //上下左右いけるか
        rep(i,4){
            //次に行くマス
            ll next_pos_y = now_pos_y + next_y.at(i);
            ll next_pos_x = now_pos_x + next_x.at(i);
            
            //場外なら何もしない
            if(next_pos_x < 0 || next_pos_x >= w || next_pos_y < 0 || next_pos_y >= h){
                continue;
            }
            
            //既に訪問済みなら何もしない
            if(dist[next_pos_y][next_pos_x] != -1){
                continue;
            }

            if(vec[next_pos_y][next_pos_x] == "#"){
                continue;
            }

            //now_posから訪問できるノードをqueに追加
            dist[next_pos_y][next_pos_x] = dist[now_pos_y][now_pos_x] + 1;
            que.push(make_pair(next_pos_y,next_pos_x));

        }

    }

    if(dist[h-1][w-1] == -1){
        cout << -1 << endl;
    }else{
        cout << (h*w) - count - dist[h-1][w-1] - 1 << endl;
    }



    


}


Measured memory_bytes: 384
x,y = map(int,input().split())
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
g3 = [2]
print('Yes') if (x in g1 and y in g1) or (x in g2 and y in g2) or (x in g3 and y in g3) else print('No')


Measured memory_bytes: 2940
#入力
n,m=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
ans=[]
for i in range(n):
    tmp_a,tmp_b=map(int,input().split())
    a.append(tmp_a)
    b.append(tmp_b)
for i in range(m):
    tmp_c,tmp_d=map(int,input().split())
    c.append(tmp_c)
    d.append(tmp_d)

#n人の生徒それぞれについて、m個のポイントへのマンハッタン距離を算出し、距離が最小のポイントをansリストに代入
for i in range(n):
    tmp_ans=[]
    for j in range(m):
        tmp_ans.append(abs(a[i]-c[j])+abs(b[i]-d[j]))
    ans.append(tmp_ans.index(min(tmp_ans))+1)
for i in range(n):
    print(ans[i])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
//const long long int INF = 1000000;
const long long int Mod = 1000000007;
const long long int mod = 10007;
using ll = long long int; //long long int は64bit
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////

ll n;
double t,a;
vi h(1001);

int main(){
    cin>>n>>t>>a;
    rep(i,n){
        cin>>h[i];
    }
    double sa=abs(a-t+0.006*h[0]);
    ll tmp = 0;
    rep(i,n){
        if(chmin(sa,abs(a-t+0.006*h[i]))){
            tmp=i;
        }
    }
    cout<<tmp+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
//Author : Koushal Bhat

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n=0;
    cin>>n;
    if(n>=30)
    {
        cout<<"Yes"<<'\n';
    }
    else
    {
        cout<<"No"<<'\n';
    }
    return 0;
}

Measured memory_bytes: 3616
t=13
S=input()
d=[0]*t
d[0]=1
for i in range(len(S)):
  n=[0]*t
  for j in range(t):
    for k in range(10):
      if S[i]=='?' or int(S[i])==k: n[(10*j+k)%t]+=d[j]
  for j in range(t): d[j]=n[j]%(10**9+7)
print(d[5])

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

typedef struct {
  int number;
  int id;
} set;

int cmpnum( const void *p, const void *q ) {
    return ((set*)p)->number - ((set*)q)->number;
}

int cmpid( const void *p, const void *q ) {
    return ((set*)p)->id - ((set*)q)->id;
}

int main(){
  int i,j,k;
  int N;
  scanf("%d",&N);
  set A[N];
  for(i=0;i<N;i++){
    scanf("%d ",&A[i].number);
    A[i].id = i;
  }
  qsort(A,sizeof(A) / sizeof(set),sizeof(set),cmpnum);
  int half = (N/2);
  int a,b;
  a = A[half-1].number;
  b = A[half].number;
  qsort(A,sizeof(A) / sizeof(set),sizeof(set),cmpid);
  for(i=0;i<N;i++){
    if(A[i].number < b){
      printf("%d\n",b);
    }
    else
      printf("%d\n",a);
  }
  return 0;
}

Measured memory_bytes: 5216
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
map<string,int> mp;
inline int read() {
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
int n;
string s;
int main() {
	n=read();
	for (register int i=1;i<=n;++i) {
		cin>>s;
		if (!mp.count(s)) mp[s]=1;
		else ++mp[s];
	}
	printf("AC x %d\n",mp["AC"]);
	printf("WA x %d\n",mp["WA"]);
	printf("TLE x %d\n",mp["TLE"]);
	printf("RE x %d\n",mp["RE"]);
	return 0;
}

Measured memory_bytes: 3744
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 3003

using namespace std;

int mod;
int C[N][N], S[N][N], pw[N];

void init(int);
int quick_pow(int ,int, int);

int main(){
	int n; cin >> n >> mod; init(n + 1);
	int ans = 0;
	for(int i = 0; i <= n; ++i){
		int sum = 0, po = quick_pow(2, n - i, mod), tmp = 1;
		for(int j = 0; j <= i; ++j, tmp = 1ll * po * tmp % mod)
			(sum += 1ll * S[i + 1][j + 1] * pw[n - i] % mod * tmp % mod) %= mod;
		sum = 1ll * sum * C[n][i] % mod;
		(ans += i & 1 ? mod - sum : sum) %= mod;
	}
	cout << ans << endl;
	return 0;
}

void init(int n){
	for(int i = 0; i <= n; ++i)
		pw[i] = quick_pow(2, quick_pow(2, i, mod - 1), mod);
	for(int i = 0; i <= n; ++i){
		C[i][0] = 1;
		for(int j = 1; j <= i; ++j)
			C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
	}
	S[0][0] = 1;
	for(int i = 1; i <= n; ++i){
		S[i][1] = 1;
		for(int j = 2; j <= i; ++j)
			S[i][j] = (S[i - 1][j - 1] + 1ll * j * S[i - 1][j] % mod) %mod;
	}
	return ;
}

int quick_pow(int x, int y, int Mod){
	int sum = 1;
	for(; y; y >>= 1, x = 1ll * x * x % Mod)
		if(y & 1) sum = 1ll * sum * x % Mod;
	return sum;
}

Measured memory_bytes: 69376