akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<ll,ll> P;

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return 1;
    }
    return 0;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return 1;
    }
    return 0;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;

struct edge{
    int cost, to;

    edge(int in_cost, int in_to){
        cost=in_cost;
        to=in_to;
    }
    bool operator<(const edge &a) const
    {
        return cost > a.cost;
    }
};

int G[510][510];
int D[32][32];
map<int,int>mp[4];
int N,C;

int strange(int a, int b, int c){
    int sum=0;

    for(int i=1; i<=C; i++){
        sum+=D[i][a]*mp[0][i];
    }

    for(int i=1; i<=C; i++){
        sum+=D[i][b]*mp[1][i];
    }

    for(int i=1; i<=C; i++){
        sum+=D[i][c]*mp[2][i];
    }

    return sum;
}
int main() {
    cin >> N >> C;
    Fill(G,0);
    Fill(D,0);

    for(int i=1; i<=C; i++){
        for(int j=1; j<=C; j++){
            cin >> D[i][j];
        }
    }
    for(int i=1; i<=N; i++){
        for(int j=1; j<=N; j++){
            int c; cin >> c;

            if( (i+j)%3 == 0)
                mp[0][c]++;
            if((i+j)%3 == 1)
                mp[1][c]++;
            if((i+j)%3 == 2)
                mp[2][c]++;
        }
    }

    int minimum=INFint;
    for(int i=1; i<=C; i++){
        for(int j=1; j<=C; j++){
            if(j==i) continue;
            for(int k=1; k<=C; k++){
                if((j==k) || (k==i))continue;
                minimum=min(minimum, strange(i,j,k));
            }
        }
    }
    cout << minimum << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

constexpr int INF = 1e9+7;
constexpr ll INFL = 9*1e18;

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

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

int inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T>inline void print(T&& x){cout<<setprecision(32)<<x<<endl;}


constexpr int SIZE = 200020;
int s[SIZE];
ll dp[SIZE];
int kA[SIZE];
pair<int,int> lr[10];
// TODO: write
int main() {
  ll waru = 998244353;
  int n,k;cin>>n>>k;
  rep(i,k){
    int l,r;cin>>l>>r;
    r++;
    lr[i] = (mp(l,r));
    for(int j = l;j <= r;++j){
      s[j]=1;
    }
  }

  dp[1] = 1;
  for(int i = 2;i <= n;++i){
    rep(j,k){
      if(i-lr[j].se > 0){
        kA[j] -= dp[i-lr[j].se];
        kA[j] %= waru;
        if(kA[j] < 0)kA[j] += waru;
        // test(i);
        // test(lr[j].se);
        // test(kA[j]);
      }
      if(i-lr[j].fi > 0){
        kA[j] += dp[i-lr[j].fi];
        kA[j] %= waru;
        // test(i-lr[j].fi);
        // test(kA[j]);
      }
      dp[i] += kA[j];
      dp[i] %= waru;
    }
  }

  // for(int i = 2;i <= n;++i){
  //   rep(j,i){
  //     if(s[j+1]){
  //       dp[i] += dp[i-j-1];
  //       dp[i] %= waru;
  //     }
  //   }
  // }
  
  print(dp[n]);
  return 0;
}

Measured memory_bytes: 5940
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    if(s=="MON")
    {
        cout<<6;
    }
    else if(s=="TUE")
    {
        cout<<5;
    }
    else if(s=="WED")
    {
        cout<<4;
    }
    else if(s=="THU")
    {
        cout<<3;
    }
    else if(s=="FRI")
    {
        cout<<2;
    }
    else if(s=="SAT")
    {
        cout<<1;
    }
    else if(s=="SUN")
    {
        cout<<7;
    }

    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <set>
#include <queue>
#include <vector>

using namespace std;

bool solve() {
    int A, B, V, W, T;
    cin >> A >> V;
    cin >> B >> W;
    cin >> T;

    if (V <= W)
        return false;
    return abs(A - B) <=  1LL * (V - W) * T;
}

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

    if (solve())
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int H,W,K; cin>>H>>W>>K;
  string ans="No";
  REP(i,0,H){
    REP(j,0,W){
      if(i*W+j*H-2*i*j==K) ans="Yes";
    }
  }
  cout<<ans<<endl;
  }


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

int main() {
  int h, w, k; cin >> h >> w >> k;
  vector<string> grid(h);
  int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
  x1--, y1--, x2--, y2--;
  for (int i=0; i<h; i++) cin >> grid[i];
  vector<vector<int>> dp(h, vector<int> (w, 1e6+1));
  queue<pair<int,int>> q;
  vector<vector<bool>> vis(h, vector<bool>(w, 0));
  dp[x1][y1] = 0;
  q.push({x1, y1});
  while (!q.empty()) {
    pair<int, int> here = q.front();
    q.pop();
    int x = here.first, y = here.second;
    vis[x][y] = 1;
    //cout << x << " " << y << endl;
    for (int i=1; i<=k && x+i<h; i++) {
      if (grid[x+i][y] == '@') break;
      if (dp[x][y]+1 <= dp[x+i][y]) {
        dp[x+i][y] = dp[x][y]+1;
        if (!vis[x+i][y])
          q.push({x+i, y}), vis[x+i][y]=1;
      }
      else break;
    }
    for (int i=1; i<=k && y+i<w; i++) {
      if (grid[x][y+i] == '@') break;
      if (dp[x][y]+1 <= dp[x][y+i]) {
        dp[x][y+i] = dp[x][y]+1;
        if (!vis[x][y+i])
          q.push({x, y+i}), vis[x][y+i]=1;
      }
      else break;
    }
    for (int i=1; i<=k && x-i>=0; i++) {
      if (grid[x-i][y] == '@') break;
      if (dp[x][y]+1 <= dp[x-i][y]) {
        dp[x-i][y] = dp[x][y]+1;
        if (!vis[x-i][y])
          q.push({x-i, y}), vis[x-i][y]=1;
      }
      else break;
    }
    for (int i=1; i<=k && y-i>=0; i++) {
      if (grid[x][y-i] == '@') break;
      if (dp[x][y]+1 <= dp[x][y-i]) {
        dp[x][y-i] = dp[x][y]+1;
        if (!vis[x][y-i])
          q.push({x, y-i}), vis[x][y-i]=1;
      }
      else break;
    }
  }
  //for (int i=0; i<h; i++) {
  //  for (int j=0; j<w; j++)
  //    cout << dp[i][j] << " ";
  //  cout << endl;
  //}
  if (dp[x2][y2] == (int)1e6+1)
    cout << -1;
  else 
    cout << dp[x2][y2];
  return 0;
}


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

int main() {
	string s; cin >> s;
	string find = "AIDUNYAN";
	map<char, int>mp;
	for (char c : find)mp[c]++;
	rep(i, (int)s.size() - (int)find.size() + 1) {
		map<char, int>se;
		rep(j, find.size())se[s[i + j]]++;
		if (se == mp) {
			s.replace(i, find.size(), "AIZUNYAN");
			i += find.size() - 1;
		}
	}
	cout << s << endl;
}

Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#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 unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = TEN(9) + 10;
const int mod = TEN(9) + 10;

int N, K, C;
string S;
int dp[200010], dp_rev[200010];
int rui[200010];

signed main()
{
	cin >> N >> K >> C;
	cin >> S;

	S = '?' + S;

	rep1(i, N) {
		dp[i] = S[i] == 'o';
		if (i - C - 1 >= 1) dp[i] += dp[i - C - 1];
		chmax(dp[i], dp[i - 1]);
	}

	for (int i = N; i >= 1; --i) {
		dp_rev[i] = S[i] == 'o';
		if (i + C + 1 <= N) dp_rev[i] += dp_rev[i + C + 1];
		chmax(dp_rev[i], dp_rev[i + 1]);
	}

	rep1(i, N) {
		if (S[i] == 'x') continue;
		if (dp[i - 1] + dp_rev[i + 1] < K) {
			printf("%lld\n", i);
		}
	}
}




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

    int main()
    {
      vector<int> a;
      int N;
      int s, t;
      int A = 0;
      int B = 0;

      cin >> N;
      //cout << N;
      //443211

      for (int i; i < N; i++)
      {
        cin >> s;
        a.push_back(s);
        //cout << a.at(i);
      }

      sort(a.begin(), a.end());
      a.erase(std::unique(a.begin(), a.end()), a.end());
      

      cout << a.size() << endl;
    }

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),n.end()
#define PI acos(-1)
using namespace std;
int main(){

  string in;
  cin>>in;
  rep(i,in.size()){
    if(in[i]-3<'A')cout<<(char)(in[i]+23);
    else cout<<(char)(in[i]-3);
  }
  cout<<endl;

}

Measured memory_bytes: 1176
from itertools import groupby
class Combination:
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fac = [1 for i in range(self.n + 1)]
        self.finv = [1 for i in range(self.n + 1)]
        for i in range(2, self.n+1):
            self.fac[i] = (self.fac[i - 1] * i) % self.mod
            self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod

    def comb(self, n, m):
        return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod
        
def iparse():
    return list(map(int, input().split()))


# RUN LENGTH ENCODING str -> tuple


def runLengthEncode(S: str):
    grouped = groupby(S)
    res = []
    for k, v in grouped:
        res.append((k, str(len(list(v)))))
    return res


if __name__ == "__main__":
    s = input()
    t = input()
    s = s + s
    for i in range(len(t)):
        if t == s[i:i+len(t)]:
            print("Yes")
            exit()
    print("No")
    
        


Measured memory_bytes: 9132
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
// using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

//#define mp make_pair
#define bug(v)                    cerr<<#v<<" = "<<(v)<<endl;
#define bug2(v1,v2)               cerr<<#v1<<" = "<<(v1)<< ' ' << #v2<<" = "<<(v2)<<endl;
#define ERASE(x)                  x.erase(unique(x.begin(),x.end()),x.end())
#define pb                        emplace_back
#define vii                       vector<int>
#define vll                       vector<ll>
#define vpll                      vector< pair <ll,ll> >
#define pll                       pair <ll,ll>
#define pii                       pair <int,int>
#define pq                        priority_queue< int >
#define khtm                      "\n"
#define F                         first
#define S                         second
#define fr(i,a,n)                 for(i=a;i<n;i++)
#define mem(arr,l)                memset(arr,l,sizeof arr)
#define ALL(x)                    x.begin(), x.end()
#define frr(i,a,n)                for(i=n-1;i>=a;i--)
#define fast                      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase                  ll T; cin>>T; while(T--)


const double pi = 3.14159265359;
const int MAX = 1e6 +2;
const ll inf =  1e18;
const int N = 1010;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
//const ll mod = 998244353;
const ll mod = 1000000007;
inline ll add(ll a,ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll mul(ll a,ll b){return (((a+mod)%mod)*(b+mod)%mod)%mod;}
inline ll power(ll a,ll b){ll rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline ll modInverse(ll n, ll p){ return power(n, p-2)%p; }

/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 
void stArt()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}
void eNd()
{
	#ifndef ONLINE_JUDGE
  	cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  	#endif
}

//////////////////// start /////////////////////////////////
 

ll i,j,k,l,m,r,n;
ll a[MAX],b[MAX];


int main()
{
 
stArt();
fast
//cout << setprecision(15) << fixed;

string s;
cin >> s;
for(auto x:s)
	k += (x-'0');
cout << (k%9?"No":"Yes");
  
 eNd();
  return 0;
 
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+101;

int n,m,a[N],fa[N];
pair<int,int> P[N];

inline int Find(int x) {
	return (fa[x]==x)?x:fa[x]=Find(fa[x]);
}

int main() {
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=m;i++) scanf("%d%d",&P[i].first,&P[i].second);
	for (int i=1;i<=n;i++) fa[i]=i;
	for (int i=1;i<=m;i++) {
		fa[Find(P[i].first)]=fa[Find(P[i].second)];
	}
	int ans=0;
	for (int i=1;i<=n;i++) {
		if (Find(i)==Find(a[i])) ans++;
	}
	cout<<ans;
	return 0;
  }

Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    h: i32,
    w: i32,
    n: i32,
  }
  let c = cmp::max(h, w);
  let ans = (n - 1) / c + 1;

  puts!("{}\n", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N);
  rep(i,N){
    cin>>A[i];
    if(i) A[i]+=A[i-1];
  }
  rep(i,N){
    cin>>B[i];
    if(i) B[i]+=B[i-1];
  }
  int ans=A[0]+B[N-1];
  rep(i,N-1) ans=max(ans,A[i+1]+B[N-1]-B[i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
def li():
    return [int(x) for x in input().split()]


N = int(input())
A = [0] + li()
total = 0
for i in range(1, N+1):
    diff = A[i] - A[i - 1]
    if diff < 0:
        total -= diff
        A[i] = A[i - 1]

print(total)

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

using namespace std;

int main()
{
    long long int a, b, c;
    long long int ans = 0;
    long long int x, y, z;

    cin >> a >> b >> c;

    if (a == b && b == c) {
        if (a%2) {
            cout << 0 << endl;
            return (0);
        }
        else {
            cout << -1 << endl;
            return (0);
        }
    }

    while (a%2 == 0 && b%2 == 0 && c%2 == 0) {
        x = a/2 + b/2;
        y = b/2 + c/2;
        z = a/2 + c/2;
        c = x;
        a = y;
        b = z;
        ans++;
    }

    cout << ans << endl;

}



Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int n,sum;
    int a[105];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    sum=a[n-1]-a[0];
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>

class Node {
    public:
        int value;
        Node* left;
        Node* right;
        Node* parent;
        Node(int);
        void join_left(Node* node);
        void join_right(Node* node);
};

Node::Node(int num)
{
    this->value = num;
    this->left = nullptr;
    this->right = nullptr;
    this->parent = nullptr;
}

void Node::join_left(Node* node)
{
    this->left = node;
    node->parent = this;
}

void Node::join_right(Node* node)
{
    this->right = node;
    node->parent = this;
}

void add_node(Node* root, Node* new_node)
{
    Node* current_node = root;
    Node* prev_node = nullptr;
    while(current_node != nullptr) {
        prev_node = current_node;
        if(current_node->value < new_node->value) {
            current_node = current_node->right;
        } else {
            current_node = current_node->left;
        }
    }
    if(prev_node->value < new_node->value) {
        prev_node->join_right(new_node);
    } else {
        prev_node->join_left(new_node);
    }
}

void print_preorder(std::list<Node>& data, Node* node)
{
    if(node == nullptr) {
        return;
    }
    printf(" %d", node->value);
    print_preorder(data, node->left);
    print_preorder(data, node->right);
}

void print_inorder(std::list<Node>& data, Node* node)
{
    if(node == nullptr) {
        return;
    }
    print_inorder(data, node->left);
    printf(" %d", node->value);
    print_inorder(data, node->right);
}

int main()
{
    char buffer[32];
    int size_of_input;
    scanf("%d", &size_of_input);
    std::list<Node> data;
    for(int i = 0; i < size_of_input; i++) {
        scanf("%32s", buffer);
        if(strcmp(buffer, "insert") == 0) {
            int value;
            scanf("%d", &value);
            if(data.empty()) {
                data.push_back(Node(value));
                continue;
            }
            data.push_back(Node(value));
            add_node(&data.front(), &data.back());
        } else if(strcmp(buffer, "print") == 0) {
            print_inorder(data, &data.front());
            putchar('\n');
            print_preorder(data, &data.front());
            putchar('\n');
        } else {
            fputs("Invalid command.\n", stderr);
            exit(EXIT_FAILURE);
        }
    }
    return EXIT_SUCCESS;
}

Measured memory_bytes: 33892
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxn = 300010;
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	int h1, s1, h2, s2;
	cin >> h1 >> s1 >> h2 >> s2;
	while (h1 && h2) {
		h2 -= s1;
		if (h2 <= 0) break;
		h1 -= s2;
		if (h1 <= 0) break;
	}
	puts(h1 > 0 ? "Yes" : "No");
}



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

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

  int ans=0;
  for (int i = 0; i < n; i++)
  {
    set<char> c;
    int j=0;
    for (; j < i; j++)
    {
      c.insert(s[j]);
    }
    set<char> d;
    for (int k = j; k < n; k++)
    {
      d.insert(s[k]);
    }
    set<char> ansset;
    set_intersection(c.begin(), c.end(),d.begin(), d.end(),inserter(ansset, ansset.end()));
    ans=max(ans,(int)ansset.size());
  }
  cout << ans << endl; 
  
}

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
	bool pr[1000001];
    REP(i, 1000001) pr[i] = true;
    pr[0] = false;
    pr[1] = false;
	int pi = 0;
	for(int i = 2; i <= 1000000; i++){ 
        if(pr[i] == true){
			pi++;
			for(int j = 2 * i; j <= 1000000; j+=i){
				pr[j] = false;
			}
		}
    }
	vector<int> primes;
	for(int i = 2; i <= 1000000; i++){
		if(pr[i]) primes.push_back(i);
	}
	
	ll A, B;
    cin >> A >> B;
    ll l = max(A, B), s = min(A, B);
	//cout << "input" << endl;
    while(s > 0){
        l = l % s;
        swap(s, l);
    } 
    ll gcd = l;
	ll now = gcd;
	int ans = 1;
    REP(i, primes.size()){
		//cout << primes[i] << endl;
		int w = primes[i];
		if(now % w == 0){
			ans++;
			while(now % w == 0){
				now /= w;
			}
		}
	}
	if(now > 1) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string bans(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int a,b,c,d;cin>>a>>b>>c>>d;
  int ans=min(a,b)+min(c,d);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define bisea binary_search
#define unsort(vec) sort(vec); rever(vec);
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  double t,x;
  cin>>t>>x;
  printf("%3.10Lf\n",t/x);
}

Measured memory_bytes: 256
#C問題
N = int(input())
H_list = list(map(int,input().split()))
ans = 0
temp = 0
for i in range(N-1):
    if H_list[i] - H_list[i+1] >= 0:
        temp += 1
        if temp > ans:
            ans = temp
    else:
        temp = 0
print(ans)

Measured memory_bytes: 14252
N = int(input())
As = list(map(int, input().split()))
odd = 0
fo = 0
for a in As:
    if a%4 == 0:
        fo += 1
    elif a%2 == 1:
        odd += 1
if odd + fo == N:
    if odd-fo <= 1:
        print('Yes')
    else:
        print('No')
else:
    if odd-fo <= 0:
        print('Yes')
    else:
        print('No')

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct SegmentTree {
  vector<Pi> data;
  vector<Pi> lazy;
  int sz;
  SegmentTree(int n) {
    sz = 1; while(sz < n) sz <<= 1;
    data.resize(2*sz-1, Pi(0, 0));
    lazy.resize(2*sz-1, Pi(0, 0));
  }
  void merge(Pi& p, Pi q) {
    //cout<<p.second<<" "<<q.first<<endl;
    if(p.second == q.first-1) {
      if(p.first == 0) p = q;
      else p.second = q.second;
    } else {
      p = Pi(-1, -1);
    }
  }
  void merge2(Pi& p, Pi q) {
    if(p.first == 0) p = q;
    else if(p.second == q.first-1) p.second = q.second;
    else p = Pi(-1, -1);
  }
  void push(int k, int l, int r) {
    if(lazy[k].first) {
      merge(data[k], lazy[k]);
      if(r - l > 1) {
	merge2(lazy[2*k+1], lazy[k]);
	merge2(lazy[2*k+2], lazy[k]);
      }
      if(lazy[k].first != -1) lazy[k] = Pi(0, 0);
    }
  }
  void update(int a, int b, int x, int k, int l, int r, bool flag) {
    push(k, l, r);
    if(r <= a || b <= l) return;
    if(a <= l && r <= b) {
      //cout<<a<<" "<<b<<" "<<x<<" "<<l<<" "<<r<<endl;
      if(flag) merge2(lazy[k], Pi(x, x));
      push(k, l, r);
      return;
    }
    update(a, b, x, 2*k+1, l, (l+r)/2, flag);
    update(a, b, x, 2*k+2, (l+r)/2, r, flag);
  }
  void update(int a, int b, int x, bool flag = true) {
    update(a, b, x, 0, 0, sz, flag);
  }
  int query(int a, int b, int x, int k, int l, int r) {
    push(k, l, r);
    if(r <= a || b <= l) return 0;
    if(a <= l && r <= b) return data[k].first == 1 && data[k].second == x;
    return query(a, b, x, 2*k+1, l, (l+r)/2) + query(a, b, x, 2*k+2, (l+r)/2, r);
  }
  int query(int a, int b, int x) {
    return query(a, b, x, 0, 0, sz);
  }
};

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, K, T;
  cin >> N >> K >> T;

  SegmentTree seg(N);

  rep(i, T) {
    int l, r, x;
    cin >> l >> r >> x;
    --l;
    seg.update(l, r, x);
  }
  int ans = 0;
  rep(i, N) {
    ans += seg.query(i, i+1, K);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 19196
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;
int N, M;
int A[123];
int main() {
	cin >> N >> M;
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		sum += A[i];
	}
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] * 4 * M >= sum) {
			++cnt;
		}
	}
	cout << (cnt >= M ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    N = input()
    T = [ int(ele) for ele in raw_input().split() ]
    M = input()
    P = [0]*M
    X = [0]*M

    for ele in xrange(M):
        P[ele], X[ele] = map(int, raw_input().split())
    
    base_time = sum(T)

    for i in xrange(M):
        after_drank = base_time - T[P[i]-1] + X[i]
        print(after_drank)

if __name__ == '__main__':
    main()

Measured memory_bytes: 2568
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {

    int a, b;
    cin >> a >> b;
    a *= b;
    if(a % 2 == 0) cout << "Even" << endl;
    else cout << "Odd" << endl;

    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    int N; cin >> N;
    vector<ll> H(N); REP(i, N) cin >> H[i];

    string res = "";
    if(N == 1) {
        res = "Yes";
    } else {
        for(int i = N - 2; i >= 0; --i) {
            if(H[i] > H[i + 1]) {
                H[i]--;

                if(H[i] > H[i + 1]) {
                    res = "No";
                    break;
                }
            }

            if(i == 0) {
                res = "Yes";
            }
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 1024
import Control.Monad
import Data.Char
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.ByteString.Char8 as BS

main = do
  [n,k] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  -- 2 <= n <= 10^5, 1 <= k <= 100
  h <- V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  -- 1 <= hi <= 10^4
  let dp = V.create $ do
        dp <- VM.new n
        VM.write dp 0 0
        forM_ [1..n-1] $ \i -> do
          c <- forM [max 0 (i-k)..i-1] $ \j -> do
            c <- VM.read dp j
            return (c + abs (h V.! i - h V.! j))
          VM.write dp i (minimum c)
        return dp
  print (V.last dp :: Int)


Measured memory_bytes: 3708
import numpy as np
from numba import njit

@njit('i8,i8,i8[::1]', cache=True)
def fn(n, k, a):
    for _ in range(k):
        b = np.zeros(n, dtype=np.int64)
        for i in range(n):
            lb = max(i - a[i], 0)
            ub = min(i + a[i], n - 1)

            b[lb] += 1
            if ub + 1 < n:
                b[ub + 1] -= 1

        a = b.cumsum()
        if np.all(a == n):
            return a
    return a

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.array(a, dtype=np.int64)

b = fn(n, k, a)
print(' '.join(b.astype(str)))


Measured memory_bytes: 149632
# -*- coding: utf-8 -*-
import heapq
import math

tmp = input()
A, B, C, D, E, F = [int(a) for a in tmp.split()]

# print valid waters
n1, n2 = [F // (a * 100) for a in [A, B]]
ws = []
for i in range(n1+1):
    for j in range(n2+1):
        if i == 0 and j == 0: continue
        a1, a2 = i, j
        w = (a1 * A + a2 * B) * 100
        if w <= F:
            ws.append(w)
        else:
            break
ws = sorted(ws)
ss = []
for w in ws:
    remain = F - w
    max_sugar = w / 100.0 * E
    max_sugar = min(remain, max_sugar)

    x = 0
    max_tmp = -1
    while x * C < max_sugar:
        y = (max_sugar - (x * C) ) // D
        s = x*C + y*D
        if s > max_tmp:
            max_tmp = s
        x += 1
    ss.append([w, max_tmp])
max_tmp = None
for i, a in enumerate(ss):
    noudo = 1.0 * a[1] / (a[0] + a[1])
    if max_tmp is None or max_tmp[2] < noudo:
        max_tmp = [a[0], a[1], noudo]
print(int(max_tmp[0]+max_tmp[1]), int(max_tmp[1]))


Measured memory_bytes: 3188
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
// scanf
#pragma warning(disable: 4996)
// v:vector  type:型  order:greater or less
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
// v:vector  default_value:初期値
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
// 丸め
#define _round(v) round(v)
// 2乗 / 3乗
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)
// 大小判定
#define _max(x,y) max(x,y)
#define _min(x,y) min(x,y)
// string ⇒ int
#define _stringtoi(s) stoi(s)
// double 平方根
#define _sqrt(x) sqrt(x)
// double 引数 x 以上で最小の整数値
#define _ceil(x) ceil(x)

int main()
{
	uint32_t min,max;
	cin >> min >> max;

	uint32_t result = 0;
	for (uint32_t i = min; i <= max; i++) {
		if (((i / 10000) % 10) != (i % 10)) { continue; }
		if (((i / 1000) % 10) != ((i / 10) % 10)) { continue; }
		result++;
	}
	printf("%d\n", result);
	return 0;
	//	std::cout << "Hello World!\n"; 
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include<set>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;///////////////////////////////////////////////////////////
int main(){
 ll n,x;
 sc(n);sc(x);  
 ll ans=1;
 ll y;
 rep(i,0,n){
  sc(y);
  if(ans==1)ans=abs(y-x);
  else ans=gcd(ans,abs(y-x));
 }
 pr(ans);
return 0;}

Measured memory_bytes: 3600
def main():
  S = str(input())
  ans = 0
  num_t = 0
  for i in range(len(S)-1, -1, -1):
    if S[i] == 'T':
      flag = True
      num_t += 1
    if S[i] == 'S' and num_t > 0 :
      num_t -= 1
      ans += 2
  print(len(S)-ans)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 9300
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		Work[] W = new Work[N];
		for(int i = 0;i < N;i++) {
			W[i] = new Work(scn.nextLong(), scn.nextLong());
		}
		Arrays.sort(W);
		long now = 0;
		boolean can = true;
		for(int i = 0;i < N && can;i++) {
			now += W[i].A;
			can &= (now <= W[i].B);
		}
		System.out.println(can?"Yes":"No");
	}

}

class Work implements Comparable<Work> {
	long A, B;

	public Work(long A, long B) {
		this.A = A;
		this.B = B;
	}

	@Override
	public int compareTo(Work o) {
		if (this.B < o.B) {
			return -1;
		} else {
			if (this.B == o.B) {
				return 0;
			} else {
				return 1;
			}
		}
	}
}


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

int main()
{   
    int n, m;
    int a, b;
    int i, j, k, l;
    int h_now = 0, w_now = 0;
    int h[1505], w[1505];
    int haba_h[1500000] = {};
    int haba_w[1500000] = {};
    int counter = 0;
    while(1){
        for(i = 0; i < 1500000; i++){
            haba_h[i] = 0;
            haba_w[i] = 0;
        }
        counter = 0;
        w_now = 0;
        h_now = 0;
        h[0] = 0;
        w[0] = 0;
        cin >> n >> m;
        if(n == 0 && m == 0){ break ;}
        
        //????????§?¨?
        for(i = 1; i <= n; i++){
            cin >> a;
        
        h_now = h_now + a;
        h[i] = h_now;
        }

        //w?????§?¨?
        for(i = 1; i <= m; i++){
            cin >> b;

            w_now = w_now + b;
            w[i] = w_now;
        }
        
        //?????????????????????????????????
        for(i = 0; i < n; i++){
            for(j = i; j <= n; j++){
                haba_h[h[j] - h[i]]++;
            }
        }

        for(i = 0; i < m; i++){
            for(j = i; j <= m; j++){
                haba_w[w[j] - w[i]]++;
            }
        }

        for(i = 1; i < 1500000; i++){
            counter = counter + haba_h[i] * haba_w[i];
        }
        cout << counter << endl;
    }
    return 0;
}
       

    

Measured memory_bytes: 14812
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<Pi,int> Pii;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int a,b,c;
	int x=0;

	cin>>a>>b>>c;

	x=a;

	if(x<b){
		x=b;
	}
	if(x<c){
		x=c;
	}

	int total=0;

	int f=0;
	if((x-a)%2==1){
		f++;
	}
	total+=(x-a)/2;
	if((x-b)%2==1){
		f++;
	}
	total+=(x-b)/2;
	if((x-c)%2==1){
		f++;
	}
	total+=(x-c)/2;
	if(f%2==1){
		total++;
	}
	total+=f/2+f%2;

	cout<<total<<endl;

	return 0;
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353
#define Graph vector<vector<int>>

Graph fri;
vector<set<int>> blo;

int dfs(int n, vector<int> &visit, int c) {
    stack<int> S;
    S.push(n);
    int cnt = 0;
    visit.at(n) = c;
    while (!S.empty()) {
        int u = S.top(); S.pop();
        for (int v = 0; v < fri.at(u).size(); v++) {
            int w = fri.at(u).at(v);
            if (visit.at(w) == -1) {
                visit.at(w) = c;
                cnt++;
                S.push(w);
            }
        }
    }
    return cnt;
}

int main() {
    int N, M, K; cin >> N >> M >> K;
    vector<int> visit(N, -1);
    fri.resize(N); blo.resize(N);
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b;
        a--; b--;
        fri.at(a).push_back(b);
        fri.at(b).push_back(a);
    }
    for (int i = 0; i < K; i++) {
        int c, d; cin >> c >> d;
        c--; d--;
        blo.at(c).insert(d);
        blo.at(d).insert(c);
    }
    map<int, int> id;
    int k = 1;
    for (int i = 0; i < N; i++) {
        int can;
        if (visit.at(i) == -1) { 
            can = dfs(i, visit, k);
            id[k] = can;
            k++;
        }
        else {
            can = id.at(visit.at(i));
        }
        int block = 0;
        for (auto p: blo.at(i)) {
            if (visit.at(i) == visit.at(p)) block++;
        }
        int ans = can - (fri.at(i).size() + block);
        if (i != N - 1) cout << ans << ' ';
        else cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 23168
s=input()
cnt=[0]*len(s)
for i in range(len(s)):
  if s[i]=='A' or s[i]=='T' or s[i]=='C' or s[i]=='G':
    if i==0:
      cnt[0]=1
    else:
      cnt[i]=cnt[i-1]+1
print(max(cnt))

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

bool in(vll l, ll p){
    rep(i, l.size()) if(l[i]==p) return true;
    return false;
}

int main(){

    ll n; cin >> n;
    map<string, ll> mp;
    vector<string> s(n);
    ll mx = 0;
    rep(i, n){
        cin >> s[i];
        mp[s[i]]++;
        mx = max(mx, mp[s[i]]);
    }

    vector<string> ans;

    set<string> st;
    rep(i, n) if(mp[s[i]]==mx) st.insert(s[i]);
    
    for(auto x:st){
        cout << x << endl;
    }

    return 0;
}

Measured memory_bytes: 40596
#include <stdio.h>

int main(void){
  int a,b;
  int coin = 0;
  scanf("%d %d",&a, &b);
  for(int i=1; i <= 2; i++){
    if(a > b) {
    coin = coin + a;
    a--;
  } else if(a < b){
      coin = coin + b;
      b--;
    } else{
      coin = coin + a;
      a--;
    }
  }
  printf("%d", coin);
  return 0;
}

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

int n;
const ll MOD=1000000007;
ll dp[1<<21];
bool mat[21][21];

int cntOnes(int x) {
    int y=0;
    while(x>0) {
        y+=x%2;
        x/=2;
    }
    return y;
}

int main() {
    cin >> n;
    for (int i=0;i<n;i++){
        for (int j=0;j<n;j++) {
            cin >> mat[i][j];
        }
    }

    dp[0]=1;
    for (int mask=0;mask<(1<<n);mask++) {
        int a=cntOnes(mask);
        for (int b=0;b<n;b++) {
            if (mask&(1<<b) || mat[a][b]==0) {continue;}
            int mask2=(mask|(1<<b));
            dp[mask2]+=dp[mask];
            dp[mask2]%=MOD;
        }
    }
    cout << dp[(1<<n)-1] << endl;

}


Measured memory_bytes: 20028
from collections import defaultdict
from itertools import chain


def fast_prime_set(n):
    # nまでの素数リスト高速版 setで返す
    # chainの読み込みが必要！
    if n < 4:
        return ({}, {}, {2}, {2, 3})[n]
    n_sqrt = int(n ** 0.5) + 1
    primes = {2, 3} | set(chain(range(5, n + 1, 6), range(7, n + 1, 6)))
    for i in range(5, n_sqrt, 2):
        if i in primes:
            primes.difference_update(range(i * i, n, i * 2))
    return primes


def prime_factorization(x):
    # 素因数分解
    # 事前に素数のセットが必要
    primes = fast_prime_set(1000)

    fact = defaultdict(int)
    for prime in primes:
        while x % prime == 0:
            fact[prime] += 1
            x //= prime
        if x == 1:
            break
        if x in primes:
            fact[x] += 1
            break
    return fact


n = int(input())
div_c = defaultdict(int)

for i in range(1, n+1):
    for item, cnt in prime_factorization(i).items():
        div_c[item] += cnt

div_c[1] = 0
ans = 1
mod = 10 ** 9 + 7

for c in div_c.values():
    ans *= (c + 1)
    ans %= mod

print(ans)


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

int main() {
  int a,b,c,d,e,f,g;
  cin >> a >> b;
  c = a+b;
  d = a-b;
  e = a*b;
  f = max (c,d);
  g = max (f,e);
  cout << g << endl;
  
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        final int A = scan.nextInt();
        final int B = scan.nextInt();
        int sum = A + B;
        int diff = A - B;
        int product = A * B;
        if(sum >= diff){
            if(product >= sum){
                System.out.println(product);
            }else{
                System.out.println(sum);
            }
        }else{
            if(product >= diff){
                System.out.println(product);
            }else{
                System.out.println(diff);
            }
        }

        scan.close();
    }
}

Measured memory_bytes: 23892
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

int main()
{
    std::string S;
    std::cin >> S;

    std::bitset<26> C;

    for (size_t i = 0; i < S.size(); ++i) {
        C.set(S[i] - 'a');
    }


    if (C.all()) {
        auto SS = S;
        if (std::next_permutation(std::begin(SS), std::end(SS))) {
            auto pair = std::mismatch(SS.begin(), SS.end(), S.begin());
            std::cout <<  std::string(SS.begin(), pair.first + 1) << endl;
        }
        else {
            std::cout << "-1" << std::endl;
        }
    }
    else {
        for (size_t i = 0; i < 26; ++i) {
            if (!C[i]) {
                std::cout << S << (char)(i + 'a') << std::endl;
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    ll ans = 0;
    sort(all(l));
    rep2(i,2,n) {
        rep2(j,1,i) {
            auto it = upper_bound(all(l),l[i]-l[j]);
            if(it-l.begin() >= j) continue;
            ans += j-(it-l.begin());
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256