akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// std::ios::sync_with_stdio(false);

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxn = 1e5+5;
int A[maxn];

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    int N;
    while (cin >> N) {
        map<int,int> cnt;
        FOR(i,0,N) {
            cin >> A[i];
            cnt[A[i]]++;
        }
        /*
         * One can can everyone else's color, but he may not see his
         * own color if his color is distinct. To be able to see his own
         * color is the only difference, so the answer can be different
         * only by 1.
         */
        bool possible = cnt.size() <= 2;
        const int maxx = cnt.rbegin()->first;
        const int minn = cnt.begin()->first;
        possible &= maxx - minn <= 1;
        possible &= maxx <= N-1;
        if (maxx == minn) {
            if (maxx != 1 && minn != N-1) {
                /* everyone must be able to see his own color */
                possible &= (N >= minn * 2);
            }
        }
        else {
            /* whoever says minn must be distinct color */
            const int dupcolor = minn - (cnt[minn]-1);
            possible &= (dupcolor > 0);
            possible &= (N - cnt[minn] >= dupcolor * 2);
        }
        const string ans = possible ? "Yes" : "No";
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define  REP(i, n) for(int i=0; i<(n); ++i)
#define  ALL(obj) (obj).begin(), (obj).end()
#define ll long long
#define ul unsigned long

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  
  int i=1, Hb, Hn;
  cin >> Hb;
  
  int max = 0;
  int count = 0;
  while(i<=N)
  {
    //cout << i << '\n';
	cin >> Hn;
    ++i;
    if(Hb >= Hn)
    {
      ++count;
    }
    if(Hb<Hn || i==N)
    {
      //cout << i <<':'<< count << ':' << max << '\n';
      max = (max < count) ? count : max;
      count = 0;
    }
    Hb = Hn;
  }
  cout << max << '\n';
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }
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;
}

#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;


typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

vector<string> split_naive(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}

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


    string s;
    cin >> s;

    vs v = split_naive(s,'/');

    //for (string i : v) cout << i << endl;

    if (stoi(v[1]) > 4 ) {
        cout << "TBD" << endl;
        return 0;
    } else if (stoi(v[1]) == 4 and stoi(v[2]) < 30) {
        cout << "Heisei" << endl;
        return 0;
    } else {
        cout << "Heisei" << endl;
        return 0;
    }


    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define DELNL        cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}

int main()
{
    ll n=in();vector<ll>a(n+1);REP(i,n)a[i+1]=in();
    vector<ll>b(n+1);

    ll m=0;
    REPR1(i,n){
        ll cnt=0;
        for(ll j=i*2;j<=n;j+=i){
            cnt+=b[j];
        }
        if(cnt%2==a[i]){
            b[i]=0;
        }else{
            b[i]=1;
            ++m;
        }
    }
    cout<<m<<endl;
    REP1(i,n)if(b[i]==1)cout<<i<<endl;
}

Measured memory_bytes: 3968
import math


def f(A, B, x):
    return math.floor(A * x / B) - A * math.floor(x / B)


def main(A, B, N):
    if N < B:
        return f(A, B, N)
    else:
        return f(A, B, B - 1)


A, B, N = map(int, input().split())
print(main(A, B, N))


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

int main() {
  string s;
  cin >> s;
  if (s=="Sunny"){
      cout << "Cloudy";
  }
  if (s=="Cloudy"){
      cout << "Rainy";
  }
  if (s=="Rainy"){
      cout << "Sunny";
  }
}


Measured memory_bytes: 256
l,r=map(int,input().split())
if r - l >= 2018:
    print(0)
    exit()
l %= 2019
r %= 2019

m=10000
for i in range(l,r):
    for j in range(i+1,r+1):
        m = min(m,(i*j)%2019)

print(m)

Measured memory_bytes: 65192
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);

  ll n;
  cin >> n;
  ll a[200010];
  rep(i, n) cin >> a[i];
  ll sum_l[200010], sum_r[200010];
  sum_l[0] = 0;
  rep(i, n) sum_l[i + 1] = sum_l[i] + a[i];
  sum_r[n] = 0;
  for (ll i = n; i > 0; --i)
  {
    sum_r[i - 1] = sum_r[i] + a[i - 1];
  }
  ll ans = LINF;
  rep(i, n)
  {
    ll l = sum_l[i];
    ll r = sum_r[i];
    ans = min(ans, abs(l - r));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main(){
  int A,B;
  cin>>A>>B;
  int tap=1;
  int ans=0;
  int i=A-1;
  while(tap<B){
    tap+=i;
    ans++;
  }
  cout<<ans<<endl;
}

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

int main() {
  ll X;
  cin >> X;
  
  ll sum = 0;
  int i = 1;
  while(true){
    sum += i;
    if(sum >= X){
      cout << i << endl;
      break;
    }
    i++;
  }
  
    
}

Measured memory_bytes: 256
w = input().lower()

ans = 0

while True:
        Text = input()
        if Text == "END_OF_TEXT":
                break
        else:
                Text = [t.lower() for t in Text.split()]

                for t in Text:
                        f = 0
                        if len(t) == len(w):
                                f = 1
                                for i,j in zip(t,w):
                                        if i != j:
                                                f = 0
                                                break
                                        
                                if f == 1:
                                        ans += 1


print(ans)


Measured memory_bytes: 5564
import java.util.*;
class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  int n=sc.nextInt();
  int []a=new int[n];
  for(int i=1;i<n;i++){
    a[sc.nextInt()-1]++;
  }
  for(int i=0;i<n;i++){
    System.out.println(a[i]);
  }
}
}

Measured memory_bytes: 61888
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define N 1010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define READ(f) freopen (f, "r", stdin)
#define WRITE(f) freopen (f, "w", stdout)
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; --i)
#define forr1(i, n)	for(int i = n; i >= 1; --i)
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define elif else if
#define lld long double
#define r0 return 0
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define db(x) cerr << #x << ": " << x << endl;

const int inf = 2e9; 
const ll infl = 2e17;
const ll modw = 998244353ll;
 
const ll mods[2] = {1000000009ll, 1000000007ll};
const ll pp[2] = {31, 53};
const int K = 355;

using namespace std;
using namespace __gnu_pbds;

pair<int, int> a[N];

int main()
{
	barnarnar
	int n;
	cin >> n;
	forn1(i, n)
	{
		cin >> a[i].fi >> a[i].se;
	}
	forn1(i, n - 2)
	{
		if(a[i].fi == a[i].se && a[i + 1].fi == a[i + 1].se && a[i + 2].fi == a[i + 2].se)	cout << "Yes", exit(0);
	}
	cout << "No";
	r0;
}
// #_# ok



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(a-c)<=d){puts("Yes");}
  else if(abs(a-b)<=d&&abs(b-c)<=d){puts("Yes");}
  else{puts("No");}
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

// dist[v] に頂点 s から頂点 v への距離を入れる関数
void dijkstra(int s, Graph &G, vector<ll> &dist){
  fill(all(dist), INF);
  dist[s] = 0;

  priority_queue<P, vector<P>, greater<P>> pq;//距離が小さい順に取り出す
  pq.push(P(0,s)); // 頂点 s からスタート

  while (!pq.empty()) {
    P p = pq.top(); pq.pop();
    int v = p.second;
    if(dist[v] < p.first) continue;// 既に v に辿り着く短い経路有ならスルー (これはただの高速化)

    for(auto e : G[v]){// v から行ける頂点 nv 達を走査
      int nv = e.to;
      ll w = e.weight;
      if(dist[nv] > dist[v] + w){
        dist[nv] = dist[v] + w;
        pq.push(P(dist[nv], nv));
      }
    }
  }
}

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};



int main(){
  int n,m,s,t; cin>>n>>m>>s>>t;
  s--; t--;
  Graph Ga(n), Gb(n);
  rep(i,m) {
    int u,v,a,b; cin >> u>>v>>a>>b;
    u--; v--;
    Ga[u].pb(Edge(v,a));
    Ga[v].pb(Edge(u,a));
    Gb[u].pb(Edge(v,b));
    Gb[v].pb(Edge(u,b));
  }

  vl dista(n),distb(n);
  dijkstra(s,Ga,dista);
  dijkstra(t,Gb,distb);

  vl d(n);
  rep(i,n) {
    d[i] = dista[i]+distb[i];
  }

  ll ans = 1e15;
  for(int i = n-1; i >= 0; i--) {
    if(i == n-1) continue;
    d[i] = min(d[i], d[i+1]);
  }
  

  rep(i,n) {
    cout << ans - d[i] << endl;
  }
  
}

Measured memory_bytes: 16124
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pr;
typedef vector<pr> vpr;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll r,d,x;
    cin >> r >> d >> x;
    rep(i,10){
        x=r*x-d;
        cout << x << endl;
    }
    return 0;
}


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

int main(){
    ll x; cin >> x;
    int ans=-1;
    for(int ix=1;ix<44724;ix++){
        ll tmp = ix*(ix-1)/2;
        if(tmp >= x){
            ans = ix-1;
            cout << ans << endl;
            return 0;
        }
    }
    
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,b;
	cin>>a>>b;
	if(a==0||(a<0&&b>0)) {
		cout<<"Zero"<<endl;
		return 0;
	} else if(a>0||(abs(b)-abs(a))%2!=0) {
		cout<<"Positive"<<endl;
		return 0;
	} else {
		cout<<"Negative"<<endl;
		return 0;
	}
}

Measured memory_bytes: 256
// darksta5's template v2.0

#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back
#define del erase
#define sz size
#define ins insert
#define FOR(a,b,c) for(int a = b; a < c; a++)
#define FORS(a,b,c) for(int a = b; a <= c; a++)
#define FORN(a,b) for(int a = 0; a < b; a++)
#define FORD(a,b,c) for (int a = b; a >= c; a--)
#define RES(a,b) memset(a,b,sizeof(a))
#define LL long long
#define PI acos(-1)
#define eps 1e-9
#define MOD 1000000007
using namespace std;

LL sumOfDigits(LL n, LL b) {
  if (n < b) {
    return n;
  }
  return sumOfDigits(n / b, b) + (LL)(n % b);
}

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

  LL n, s;
  scanf("%lld%lld", &n, &s);

  if (s > n) {
    printf("-1\n");
    return 0;
  }

  if (n == s) {
    printf("%lld\n", n + 1);
    return 0;
  }

  FORS(i, 2, (int)sqrt(n)) {
    if (sumOfDigits(n, (LL)i) == s) {
      printf("%d\n", i);
      return 0;
    }
  }

  FORD(i, (int)sqrt(n-s), 1) {
    if ((n-s) % i == 0) {
      LL ans = ((n-s)/(LL)i + 1LL);
      if ((ans > (int)sqrt(n)) && (sumOfDigits(n, ans) == s)) {
        printf("%lld\n", ans);
        return 0;
      }
    }
  }

  printf("-1\n");
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return p;
}
int main(){
  ll i,N,M,K,a,b,cnt=1;
  cin>>N>>M;
  mat v(N),rv(N);
  vec inlis(N,0),sorted(N);
  rep(i,N+M-1){
    cin>>a>>b;
    a--;b--;
    v[a].push_back(b);
    rv[b].push_back(a);
    inlis[b]++;
  }
  rep(i,N){
    if(!inlis[i])K=i;
  }
  sorted[0]=K;
  queue<ll> que;
  for(auto i:v[K]){
    inlis[i]--;
    if(!inlis[i])que.push(i);
  }
  while(!que.empty()){
    K=que.front();que.pop();
    sorted[cnt++]=K;
    for(auto i:v[K]){
      inlis[i]--;
      if(!inlis[i])que.push(i);
    }
  }
  rep(i,N){
    inlis[sorted[i]]=i;
  }
  rep(i,N){
    a=b=-1;
    for(auto j:rv[i]){
      if(a<inlis[j]){
        a=inlis[j];
        b=j;
      }
    }
    cout<<b+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 13312
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int n, m, x;
vector<ll> c;
vector<vector<ll>> a;

int main() {
    cin >> n >> m >> x;
    c.resize(n);
    a = vector<vector<ll>>(n, vector<ll>(m));
    rep(i, n) {
        cin >> c[i];
        rep(j, m) { cin >> a[i][j]; }
    }
    vector<ll> val(m);
    int ans = inf;
    for (int s = 0; s < (1 << n); s++) {
        fill(all(val), 0);
        int sum = 0;
        rep(i, n) {
            if (s & (1 << i)) {
                sum += c[i];
                rep(j, m) { val[j] += a[i][j]; }
            }
        }
        bool flag = true;
        rep(j, m) {
            if (val[j] < x) {
                flag = false;
                break;
            }
        }
        if (flag) {
            ans = min(ans, sum);
        }
    }
    if (ans != inf)
        cout << ans << endl;
    else
        cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3620
/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

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

const int N = (int)2e6 + 5;
const int inf = (int)1e9 + 7;

int n;

int main(){
  scanf("%d", &n);
  printf("%d", n * n * n);
  return 0;
}


Measured memory_bytes: 256
X = gets.to_i

require 'prime'

def ds(n)
  n.prime_division.inject([1]){|a, (p, e)| (0 .. e).map{p**_1}.product(a).map{_1*_2}}.sort
end

ds(X).each do |d|
  b = (-d/2 .. 10**9).bsearch{|x| (x + d)**5 - x**5 >= X}
  if (b + d)**5 - b**5 == X
    puts [b + d, b].join(' ')
    exit
  end
end

Measured memory_bytes: 14492
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a[5];
  for(int i=0;i<4;i++)
    cin>>a[i];
  sort(a,a+4);
  if(a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9)
    cout<<"YES";
  else
    cout<<"NO";
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int a, b, k, c;

		cin>>a>>b>>k;

	for (c = a;c <=b;c += 1) {
		if (c <=a + k - 1 || c >= b - k + 1) {
			cout << c << endl;
		}
		}

	
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll m, n, k;
	cin >> m >> n >> k;

	vector<tuple<ll,ll,ll>> items(k);
	FOR(i,0,k) {
		ll x, y, c;
		cin >> x >> y >> c;
		items[i] = make_tuple(x-1,y-1,c);
	}
	sort(all(items));
	
	vvl dp(n, vl(4));
	ll p = 0;
	FOR(i,0,m) {
		vvl ndp(n, vl(4));
		
		FOR(j,0,n) {
			ndp[j][0] = *max_element(all(dp[j]));
			if (j) FOR(t,0,4) ndp[j][t] = max(ndp[j][t], ndp[j-1][t]);
			
			if (p < k && get<0>(items[p]) == i && get<1>(items[p]) == j) {
				FORD(t,0,3) ndp[j][t+1] = max(ndp[j][t+1], ndp[j][t] + get<2>(items[p]));
				p++;
			}
		}

		dp = ndp;
	}
	
	ll res = 0;
	FOR(j,0,n) FOR(t,0,4) res = max(res, dp[j][t]);
	cout << res << endl;
}



Measured memory_bytes: 8428
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
using namespace std;
using ll = long long int;
//typedef pair<int,int> P;
 
 int main(void){
	 int TH,TA,AH,AA;
	 cin >> TH >> TA >>AH >>AA;
	 while(1){
		 AH-=TA;
		 if(AH<=0){
			 printf("Yes");
			 return 0;
		 }
		 TH-=AA;;
		 if(TH<=0){
			 printf("No");
			 return 0;
		 }
	 }
 }

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repe(i, n) for(int (i) = 0; i <= (n); (i)++)
#define repr(i, n) for(int (i) = (n); (i) > 0; --(i))
#define repre(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define elm1(pair) (pair).first
#define elm2(pair) (pair)).second
typedef long long ll;
typedef unsigned long long ull;
const ull MOD = 1000000007;
ull mpow(ull a, ull n);
ull inv_mod(ull a){return mpow(a, MOD-2);}

ull mpow(ull a, ull n)
{
    ull ans = 1;
    while(n>>=1){
        if(n & 1)(ans *= a)%= MOD;
        (a*=a)%=MOD;
    }
    return ans;
}

ull nCr(ull n, ull r)
{
    vector<ull> factorial(n+1);
    factorial[0]=1;
    rep(i, n)factorial[i+1] = factorial[i]*(i+1)%MOD;
    return factorial[n]*(inv_mod(factorial[n-r])%MOD*inv_mod(factorial[r])%MOD) % MOD;
}

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

    rep(i, s.size()){
        s[i]+=n;
        if(s[i] > 'Z') s[i]-=(('Z' - ('A' - 1)));
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;

int main() {
	long long X, Y;
	cin >> X >> Y;
	
	long long int t=X;
	int k = 1;
	while (1) {
		t *= 2;
		if (t > Y) break;
		k++;
	}
	cout << k << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

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


int main(){
    int n, r;   cin >> n >> r;
    if(n >= 10){
        cout << r << endl;
    }
    else{
        cout << r + 100 * (10 - n) << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;
 
int A, B, C, D;
 
int main()
{
	in >> A >> B >> C >> D;
 
	if ((B < C) || (D < A))
	{
		out << 0 << std::endl;
	}
	else if (A <= C&&D <= B)
	{
		out << D - C << std::endl;
	}
	else if (C <= A&&B <= D)
	{
		out << B - A << std::endl;
	}
	else if (A <= C&&B <= D)
	{
		out << B - C << std::endl;
	}
	else if (C <= A&&D <= B)
	{
		out << D - A << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int W;
    int H;
    int x;
    int y;
    int r;

    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    
    if ( ((x + r <= W) && (x - r >= 0)) && ((y + r <= H) && (y - r >= 0)) ) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    
    return 0;
}


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

int compare_int(const void *a,const void *b){
  if(*(int*)a > *(int*)b) return 1;
  return -1;
}

int main(void){
  int N;
  scanf("%d",&N);

  int X[N],Y[N];
  for (int i = 0; i < N; i++) {
    scanf("%d",&X[i]);
    Y[i] = X[i];
  }

  qsort(Y,N,sizeof(int),compare_int);
  int a = Y[N/2-1];
  int b = Y[N/2];

  for (int i = 0; i < N; i++) {
    if(X[i] <= a) printf("%d\n",b);
    else printf("%d\n",a);
  }

  return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,i;
	cin>>a;
	int b[a+1],c[a+1];
    for(i=1;i<=a;i++)
    {
    cin>>b[i];
    c[i]=i;
}
    int e[a+1];
    for(i=1;i<=a;i++)
    e[b[i]]=c[i];
    for(i=1;i<=a;i++)
    cout<<e[i]<<' ';
    return 0;
}

Measured memory_bytes: 2048
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

long long min(int len, ...) {
    long long i, _min, num;
    va_list ap;
    va_start(ap, len);

    _min = va_arg(ap, long long);
    for (i = 1; i < len; i++) {
        num = va_arg(ap, long long);
        if (num < _min)
            _min = num;
    }
    va_end(ap);
    return _min;
}

int binary(long long *src, int len, long long trg) {
    // assumed src[0..len+1] 
    int low, hi, mid;
    low = 0; hi = len+1;
    while (low < hi) {
        mid = low + (hi-low)/2;
        if (trg < *(src+mid)) hi = mid;
        else low = mid+1;
    }
    return low;
}

#define INF 1000000000000000000LL

int main(void) {
    int i, j, k, l, m, n, A, B, Q;
    long long s[100010], t[100010], x, res, d1, d2;
    scanf("%d%d%d", &A, &B, &Q);
    for (i=1;i<=A;i++) scanf("%lld", &s[i]);
    s[0] = -INF; s[A+1] = INF;
    for (j=1;j<=B;j++) scanf("%lld", &t[j]);
    t[0] = -INF; t[B+1] = INF;

    for (i=1;i<=Q;i++) {
        scanf("%lld", &x);
        k = binary(s, A, x);
        l = binary(t, B, x);
        res = INF;
        for (m=k-1;m<=k;m++) for (n=l-1;n<=l;n++) {
            d1 = llabs(s[m] - x) + llabs(t[n] - s[m]);
            d2 = llabs(t[n] - x) + llabs(s[m] - t[n]);
            res = min( 3, res, d1, d2);
        }
        printf("%lld\n", res);
    }

    return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#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>;
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;

ll n,a,b;
vector<ll> h;

int solve(ll l,ll r) {
    if(r-l == 1) return r;
    ll mid = (l+r)/2;
    ll sum = 0;
    rep(i,n) sum += (max(0LL,h[i]-b*mid)+(a-b)-1)/(a-b);
    if(sum <= mid) return solve(l,mid);
    else return solve(mid,r);
}

int main() {
    cin >> n >> a >> b;
    h.resize(n);
    rep(i,n) cin >> h[i];
    cout << solve(0,1000000001) << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std ;
int gcd(int a , int b)
{
    if(a == 0)
    {
        return b ;
    }
    return gcd( ( b % a ) , a ) ;
}
int main()
{
    int n , k , c , ans = 0 , a[200010] , cnt = 0 ;
    cin >> k ; 
    for(int i = 1 ; i <= k ; i++)
    {
        for(int j = 1 ; j <= k ; j++)
        {
            for(int l = 1 ; l <= k ; l++)
            {
                ans += gcd(gcd(i,j),l);       
            }   
        }   
    }
    cout << ans << endl ;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

int mod(int a, int b){return (a%b+b)%b;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void judge(bool b){b?Yes():No();}

template<typename T>
void ppp(T n){cout << n << endl;}

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


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef map<int, int> mint;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstr;



vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

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

    int n;
    cin >> n;
    vll luca(90);

    luca[0]=2;
    luca[1]=1;
    rep(i, 85)
        luca[i+2]=luca[i+1]+luca[i];
    ppp(luca[n]);



    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A, B;
    cin >> A >> B;
    int ans = A + B;
    if(ans < 24)
    {
        cout << ans << endl;
    }
    if(ans > 24)
    {
        int ans1  = ans - 24;
        cout << ans1 << endl;
    }
    if(ans == 24)
    {
    int ans2 = 0;
    cout << ans2 << endl;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <map>

using namespace std;
using lli = long long int;
using ll = long long;

int main() {
    lli a, b, c;
    cin >> a >> b >> c;

    lli d = c - a - b;

    if (d < 0) {
        cout << "No" << endl;
        return 0;
    }
    
    if (d > 0 && d * d > 4 * a * b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i=0; i<n; i++) {
    cin >> v[i];
  }
  
  int sum = 0;
  for(int i=0; i<n-1; i++) {
    for(int j=1; j<n; j++) {
      if (i<j) { 
        sum += v[i]*v[j];
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3644
s=input()
t=input()

ds = {}
dt = {}
for letter in s:
    ds.setdefault(letter,0)
    ds[letter]+=1

for letter in t:
    dt.setdefault(letter,0)
    dt[letter]+=1

if sorted(ds.values()) == sorted(dt.values()):
    print("Yes")
else:
    print("No")


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

using namespace std;

const int N = 200005;

struct Node {
  int val[3];
  Node() {
    val[0] = val[1] = val[2] = INT_MAX;
  }
};

int a[N], m[N];

struct S {
  int l, r, val;
  bool operator < (const S &b) const {
    return val > b.val;
  }
};

int n;
Node seg[N << 2];

void add(int id, int l, int r, int loc, int data) {
  if (l == r) {
    seg[id].val[loc & 1] = data;
    seg[id].val[2] = data;
    return ;
  }
  int mid = (l + r) >> 1;
  if (loc <= mid) {
    add(id << 1, l, mid, loc, data);
  }
  else {
    add(id << 1 | 1, mid + 1, r, loc, data);
  }
  seg[id].val[0] = min(seg[id << 1].val[0], seg[id << 1 | 1].val[0]);
  seg[id].val[1] = min(seg[id << 1].val[1], seg[id << 1 | 1].val[1]);
  seg[id].val[2] = min(seg[id << 1].val[2], seg[id << 1 | 1].val[2]);
}

int query(int id, int l, int r, int ll, int rr, int flag) {
  if (l == ll && r == rr) {
    return seg[id].val[flag];
  }
  int mid = (l + r) >> 1;
  if (mid >= rr) {
    return query(id << 1, l, mid, ll, rr, flag);
  }
  if (mid < ll) {
    return query(id << 1 | 1, mid + 1, r, ll, rr, flag);
  }
  return min(query(id << 1, l, mid, ll, mid, flag), query(id << 1 | 1, mid + 1, r, mid + 1, rr, flag));
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    m[a[i]] = i;
    add(1, 1, n, i, a[i]);
  }
  a[n + 1] = INT_MAX;
  priority_queue<S> q;
  q.push({1, n, query(1, 1, n, 1, n, 1)});
  vector<int> res;
  while (!q.empty()) {
    S s = q.top();
    q.pop();
    res.push_back(s.val);
    int now = m[s.val];
    int go = query(1, 1, n, now + 1, s.r, (now & 1) ^ 1);
    res.push_back(go);
    go = m[go];
    if (now > s.l) {
      q.push({s.l, now - 1, query(1, 1, n, s.l, now - 1, s.l & 1)});
    }
    if (now + 1 < go) {
      q.push({now + 1, go - 1, query(1, 1, n, now + 1, go - 1, (now + 1) & 1)});
    }
    if (go < s.r) {
      q.push({go + 1, s.r, query(1, 1, n, go + 1, s.r, (go + 1) & 1)});
    }
  }
  for (int i = 0; i < n ; ++i) {
    printf("%d%c", res[i], i < n - 1 ? ' ' : '\n');
  }
  return 0;
}


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

int main(void) {

	int a, b, c = 0;

	cin >> a >> b;

	if (b <= 9) c += b + a * 10;
	else if (b <= 99) c += b + a * 100;
	else c += b + a * 1000;

	for (int i = 1; i*i <= c; i++) {
		if (i*i == c) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#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<iomanip>
#include<tuple>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    int a[100000];
    int cnt=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        //cout<<a[i]<<endl;
    }
    for(int i=0;i<n;i++){
        while(a[i]%2==0){
            a[i]=int(a[i]/2);
            cnt+=1;
            if(a[i]%2!=0){
            break;
            }
            //cout<<a[i]<<endl;
            //cout<<cnt<<endl;
        }
    }
    cout<<cnt<<endl;
     
  

    return 0;
}

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

int main(){
    string b;
    cin >> b;
    if(b == "A"){
        cout << "T" << endl;
    }else if(b == "T"){
        cout << "A" << endl;
    }else if(b == "G"){
        cout << "C"<< endl;
    }else if(b == "C"){
        cout << "G" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;

int h, w;
char grid[101][101];
bool check[101][101];
bool erasedJ[101];
bool erasedI[101];


int main()
{
	memset(check, true, sizeof(check));
	memset(check, false, sizeof(erasedJ));
	memset(check, false, sizeof(erasedI));

	scanf("%d %d", &h, &w);

	for (int j = 1; j <= h; ++j)
		for (int i = 1; i <= w; ++i)
			scanf("\n%c", &grid[j][i]);

	for (int j = 1; j <= h; ++j)
	{
		bool canErase = true;
		for (int i = 1; i <= w; ++i)
		{
			if (grid[j][i] == '#')
			{
				canErase = false;
				break;
			}
		}
		if (canErase)
		{
			for (int i = 1; i <= w; ++i)
				check[j][i] = false;
			erasedJ[j] = true;
		}


	}

	for (int i = 1; i <= w; ++i)
	{
		bool canErase = true;
		for (int j = 1; j <= h; ++j)
		{
			if (grid[j][i] == '#')
			{
				canErase = false;
				break;
			}
		}
		if (canErase)
		{
			for (int j = 1; j <= h; ++j)
				check[j][i] = false;
			erasedI[i] = true;
		}


	}

	for (int j = 1; j <= h; ++j)
	{
		if (erasedJ[j])
			continue;

		for (int i = 1; i <= w; ++i)
		{
			if (erasedI[i])
				continue;

			if (check[j][i] == true)
				cout << grid[j][i];
		}


		cout << endl;
	}
		
}

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

int main() {
  int A,B;
  cin >> A >> B;
  int ans = 0;
  for(int i = A ; i < B + 1 ; i++){
    string j = to_string(i);
    if(j.at(0) == j.at(4) && j.at(1) == j.at(3)) ans++; 
  }
  cout << ans << endl;
}


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

const ll INF = 1LL << 60;

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

    ll r = 0, g = 0, b = 0;
    rep(i, S.size()) {
        if (S[i] == 'R') r++;
        if (S[i] == 'G') g++;
        if (S[i] == 'B') b++;
    }
    ll ans = r * g * b;

    rep(k, N) {
        // 中点
        for (int j = 1; j <= N - 1; j++) {
            if (j - k - 1 < 0) continue;
            if (j + k + 1 >= N) continue; 

            if (S[j] != S[j - k - 1] && S[j] != S[j + k + 1] &&
                S[j - k - 1] != S[j + k + 1]) {
                ans--;
            }
        }
    }

    cout << ans << endl;
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int n;cin>>n;
  std::vector<int> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  sort(v.begin(), v.end());
  int n2=n/2;
  if(v[n2-1]==v[n2]){
    cout<<0<<endl;
    return 0;
  }
  cout<<v[n2]-v[n2-1]<<endl;

  return 0;
}


Measured memory_bytes: 640
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)
    val s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
    println(s.split(", ")[sc.nextInt() - 1])
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 35504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<(int)n;i++)
const ll INF = (1LL<<60)-1;
const int MOD = 1000000007;

int main(){
    ll a,b,c,d; cin >> a >> b >> c >> d;
    ll res = -INF;
    res = max(res,a*c);
    res = max(res,a*d);
    res = max(res,b*c);
    res = max(res,b*d);
    cout << res << endl;
}

Measured memory_bytes: 3632
def LI():return list(map(int,input().split()))

n,m=LI()
h=LI()
edge=[[] for _ in range(n)]
for i in range(m):
    a,b=LI()
    a-=1
    b-=1
    edge[a].append(b)
    edge[b].append(a)
    
ans=0
for i in range(n):
    if all([h[i]-h[v]>0 for v in edge[i]]):
        # print(i)
        ans+=1

print(ans)


Measured memory_bytes: 96900
n, m, q = map(int, input().split())
trains = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
    l, r = map(int, input().split())
    trains[l][r] += 1

for i in range(n):
    for j in range(n):
        trains[i][j + 1] += trains[i][j]
for i in range(n):
    for j in range(n):
        trains[i + 1][j + 1] += trains[i][j + 1]

for _ in range(q):
    p, q = map(int, input().split())
    ans = trains[q][q] - trains[q][p - 1] - trains[p - 1][q] + trains[p - 1][p - 1]
    print(ans)


Measured memory_bytes: 58584
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

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

	LL a, b;
	
	while ( cin >> a >> b )
	{
		LL res1 = gcd( a, b );
		LL res2 = a * b / res1;

		cout << res1 << ' ' << res2 << endl;
	}

	return 0;
}

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

int sumsum(int n) {
  int sum =0;
  while(n>0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int N;
  cin>>N;
  string ans = "No";
  if(N % sumsum(N) == 0){
    ans ="Yes";
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int arr[6];

int main() {
	fastio; FOR(i, 1, 5) {
      cin >> arr[i];
      if (arr[i] == 0) {
        cout << i;
        return 0;
      }
    }
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n";
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+10;
int32_t main()
{
	IOS;
	string s;
	cin>>s;
	cout<<s[0]<<s[1]<<s[2]<<endl;




	


}







































Measured memory_bytes: 3652
#include <iostream>
#include <cmath>

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

using namespace std;

double memo[1001][2];

void calc()
{
	memo[0][0] = 1;
	memo[0][1] = 0;
	double angle = 0;

	REP(i,1,1001)
	{
		double r = sqrt(1.0 + i);
		double sin_ = 1.0 / r;
		angle += asin(sin_);
		memo[i][0] = r * cos(angle);
		memo[i][1] = r * sin(angle);
	}
}

int main()
{
	int n;
	double x,y;
	calc();
	while(cin >> n,n != -1)
	{
		cout << fixed;
		cout.precision(2);
		cout << memo[n-1][0] << endl;

		cout << fixed;
		cout.precision(2);
		cout << memo[n-1][1] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1288
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	string s;
	cin>>s;
	for(int i=0;i<3;i++)
	if(s[i]==s[i+1]){
		cout<<"Bad\n";
		return 0;
	}
	cout<<"Good\n";
    return 0;
}



Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int a, b, c;
	int n;
	int i;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%d %d %d", &a, &b, &c);
		
		if (a * a + b * b == c * c){
			printf("YES\n");
		}
		else if (b * b + c * c == a * a){
			printf("YES\n");
		}
		else if (c * c + a * a == b * b){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	return (0);
}

Measured memory_bytes: 580