akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-


def main():
    import sys
    input = sys.stdin.readline

    n, m = map(int, input().split())
    first = list()
    second = list()

    for i in range(m):
        ai, bi = map(int, input().split())

        if ai == 1:
            first.append(bi)

        if bi == n:
            second.append(ai)

    ans = set(first) & set(second)

    if len(ans) > 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')


if __name__ == '__main__':
    main()


Measured memory_bytes: 27672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int N;
ll h[100010];

ll dp[100010];

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

    for(int i=0; i<100010; ++i) dp[i] = INF;
    dp[0] = 0;

    for(int i=0; i<N; ++i) {
        for(int j=1; j<=K; j++) {
            chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 5200
// Last Change: 11/07/2019 18:45:56.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

ll ns_pow(ll val, ll n) {
  ll res = 1;
  for (ll i = 0; i < n; ++i) {
    res *= val;
  }
  return res;
}

int main() {
  ll e;
  while (cin >> e and e != 0) {
    ll x, y, z, m;
    m = numeric_limits<ll>::max();
    for (z = 0; ns_pow(z, 3) <= e; ++z) {
      for (y = 0; ns_pow(y, 2) + ns_pow(z, 3) <= e; ++y) {
        x = e - ns_pow(y, 2) - ns_pow(z, 3);
        if (x < 0) {
          continue;
          // break;
        }
        m = min(m, x + y + z);
      }
    }
    cout << m << endl;
  }
}



Measured memory_bytes: 2980
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main() {
	int N;
	cin >> N;
	set<int> S;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		if (S.find(a) == S.end()) S.insert(a);
		else S.erase(a);
	}
	cout << S.size() << endl;
	return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define N 100005
#define vi vector<int>
#define all(v) v.begin(),v.end()
vector<int>adj[N];
int dp[N];
bool vis[N]={false};
int dfs(int x)
{
    vis[x]=true;
    dp[x]=0;
    for(auto y:adj[x])
    {
        if(!vis[y])
        {
            dfs(y);
        }
        dp[x]=max(dp[x],1+dp[y]);
    }
}
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,m;
   cin>>n>>m;
   for(int i=0;i<m;i++)
   {
       int u,v;
       cin>>u>>v;
       adj[u].pb(v);
   }
   for(int i=1;i<=n;i++)
    adj[0].pb(i);
   dfs(0);
   cout<<dp[0]-1<<endl;
}


Measured memory_bytes: 9588
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#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,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


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

    if (a%2 == 0 || b%2 == 0 || c%2 == 0) {
        puts("0");
        return 0;
    }

    ll ans = a*b;
    ans = min(ans, b*c);
    ans = min(ans, c*a);

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

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

mt19937 rng (chrono::steady_clock::now().time_since_epoch().count() );

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 200001; //check the limits, dummy

int main() {
    ios_base::sync_with_stdio (0);
    cin.tie (0);
    ll n, k;
    cin >> n >> k;
    vl a (n), b (n);
    for (ll i = 0; i < n; i++) cin >> a[i];
    for (ll i = 0; i < n; i++) cin >> b[i];
    sort (begin (a), end (a) );
    sort (begin (b), end (b) );
    vpl al (n);
    for (ll i = 0; i < n; i++) {
        al[i] = {a[i] * b[n - i - 1], b[n - i - 1]};
    }
    sort (all (al) );
    ll low = 0, high = al[n - 1].first + 12;
    ll ans = al[n - 1].first;
    while (low <= high) {
        ll mid = (low + high) / 2;
        ll tot = 0;
        for (ll i = 0; i < n; i++) {
            if (al[i].first > mid) {
                tot += (al[i].first - mid + al[i].second - 1) / al[i].second;
            }
        }
        if (tot <= k) {
            ans = min (ans, mid);
            high = mid - 1;
        } else {
            low = mid + 1;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 6528
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

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

template <typename T>
struct edge {int to; T cap; int rev;};

template <typename T>
struct Graph_ {
  int n;
  vector<bool> used;
  vector<vector<edge<T>> > vec;
  Graph_(int ns) {
    n = ns;
    used.resize(n);
    vec.resize(n);
  }
  void adde(int at, int to, T cap){
    vec[at].pb((edge<T>){to, cap, (int)vec[to].size()});
    vec[to].pb((edge<T>){at, 0, (int)vec[at].size() - 1});
  }
  T dfs(int s, int t, T f){
    if(s == t)return f;
    used[s] = true;
    for(int i = 0; i < vec[s].size(); i++){
      edge<T> &e = vec[s][i];
      if(!used[e.to] && e.cap > 0){
        int d = dfs(e.to, t, min(f, e.cap));
        if(d > 0){
          e.cap -= d;
          vec[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  T min_cut(int s, int t){
    return max_flow(s, t);
  }
  T max_flow(int s, int t){
    T inf = numeric_limits<T>::max();
    T flow = 0;

    while(true){
      fill(used.begin(), used.end(), false);
      int f = dfs(s, t, inf);
      if(f == 0)return flow;
      flow += f;
    }
  }
};

typedef Graph_<int> GraphI;
typedef Graph_<ll> GraphL;

int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<ll> a(n);
  ll sum = 0;
  rep(i, n){
    cin >> a[i];
    if(a[i] > 0)sum += a[i];
  }
  GraphL graph(n + 2);
  for(int i = 0; i < n; i++){
    if(a[i] > 0)graph.adde(0, i+1, 0);
    else graph.adde(0, i+1, - a[i]);
    if(a[i] > 0)graph.adde(i+1, n+1, a[i]);
    else graph.adde(i+1, n+1, 0);
  }
  for(int i = 1; i <= n; i++){
    for(int j = 2 * i; j <= n; j+=i){
      graph.adde(i, j, linf);
    }
  }
  cout << sum - graph.min_cut(0, n+1) << endl;
	return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {

  var inp = input.split('\n');
  var N = parseInt(inp[0]);
  var d = [];
  for (var i = 1; i <= N; i++) {
    d.push(parseInt(inp[i]));
  }

  // 重複削除
  var editedArray = d.filter(function (e, i, ary) {
    return ary.indexOf(e) === i;
  });

  // 降順ソート
  editedArray.sort(function(p1, p2){
    if( p1 > p2 ) return -1;
    if( p1 < p2 ) return 1;
    return 0;
});

  // console.log(editedArray);

  console.log('%d', editedArray.length);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
using System;
using System.Collections.Generic;
 
namespace Echo
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputN = int.Parse(Console.ReadLine());
            string inputS = Console.ReadLine();
 
            List<char> inputString = new List<char>(inputS);
            int middlePoint = inputString.Count / 2;
            if (inputN % 2 != 0)
            {
                Console.WriteLine("No");
                return;
            }
            else
            {
                for (int i = 0; i < middlePoint; i++)
                {
                    if (inputString[i] != inputString[middlePoint + i])
                    {
                        Console.WriteLine("No");
                        return;
                    }
                }
                Console.WriteLine("Yes");
            }
        }
    }
}

Measured memory_bytes: 13268
N=int(input())
A=list(map(int,input().split(" ")))
order=[0 for i in range(N+1)]
text=""
for i in range(len(A)):
    order[A[i]]=i+1
for i in range(1,len(A)+1):
  	text+=str(order[i])+" "
print(text)

Measured memory_bytes: 13812
import sys
input = sys.stdin.readline


class Node:
    def __init__(self, val):
        self.val = val
        self.prev, self.next = None, None


class DoublyLinkedList:
    def __init__(self):
        self.n = 0
        self.dummy = Node(None)
        self.dummy.prev = self.dummy
        self.dummy.next = self.dummy

    def __getitem__(self, i):
        if i < 0 or i >= self.n:
            raise IndexError()
        return self._get_node(i).val 

    def __setitem__(self, i):
        if i < 0 or i >= self.n:
            raise IndexError()
        return self._get_node(i).val

    def __len__(self):
        return self.n

    def __bool__(self):
        return self.n != 0

    def __iter__(self):
        self.p = self.dummy
        return self

    def __next__(self):
        self.p = self.p.next
        if self.p == self.dummy:
            raise StopIteration
        return self.p.val

    def append(self, val):
        ptr = self.dummy.prev
        new_ptr = Node(val)
        new_ptr.prev = ptr.prev
        new_ptr.next = ptr
        new_ptr.next.prev = new_ptr
        new_ptr.prev.next = new_ptr
        self.n += 1

    def appendleft(self, val):
        ptr = self.dummy.next
        new_ptr = Node(val)
        new_ptr.prev = ptr.prev
        new_ptr.next = ptr
        new_ptr.next.prev = new_ptr
        new_ptr.prev.next = new_ptr
        self.n += 1

    def pop(self):
        ptr = self.dummy.prev
        ptr.prev.next = ptr.next
        ptr.next.prev = ptr.prev
        self.n -= 1

    def popleft(self):
        ptr = self.dummy.next
        ptr.prev.next = ptr.next
        ptr.next.prev = ptr.prev
        self.n -= 1

    def _get_node(self, i):
        if i < self.n // 2:
            ptr = self.dummy.next
            for _ in range(i):
                ptr = ptr.next
        else:
            ptr = self.dummy
            for _ in range(i, self.n):
                ptr = ptr.prev
        return ptr

    def _remove(self, i):
        if i < 0 or i >= self.n:
            raise IndexError()
        ptr = self._get_node(i)
        ptr.prev.next = ptr.next
        ptr.next.prev = ptr.prev
        self.n -= 1
        return ptr.val

    def _add(self, i, val):
        if i < 0 or i > self.n:
            raise IndexError()
        ptr = self._get_node(i)
        new_ptr = Node(val)
        new_ptr.prev = ptr.prev
        new_ptr.next = ptr
        new_ptr.next.prev = new_ptr
        new_ptr.prev.next = new_ptr
        self.n += 1

    def delete(self, val):
        ptr = self.dummy
        for _ in range(self.n):
            ptr = ptr.next
            if ptr.val == val:
                ptr.prev.next = ptr.next
                ptr.next.prev = ptr.prev
                self.n -= 1
                return True
        return False


dls = DoublyLinkedList()
input()
for query in sys.stdin:
    if query[0] == "i":
        val = query[7:-1]
        dls.appendleft(val)
    elif query[6] == "F":
        dls.popleft()
    elif query[6] == "L":
        dls.pop()
    else:
        val = query[7:-1]
        dls.delete(val)

print(*list(dls))


Measured memory_bytes: 227556
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    getline(cin,s);
    for(int i=0;i<s.size();i++){
        if(isupper(s.at(i))) s.at(i) = tolower(s.at(i));
        else if(islower(s.at(i))) s.at(i) = toupper(s.at(i));
    }
    cout << s << endl;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
int main()
{
    ll n;
    cin>>n;
    map<ll,ll> a;
    ll ans=0;
    rep(i,n){
        ll x;
        cin>>x;
        a[x]++;
        ans+=x;
    }
    ll q;
    cin>>q;
    rep(i,q){
        ll b,c;
        cin>>b>>c;
        ans+=(c-b)*a[b];
        a[c]+=a[b];
        a[b]=0;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 9552
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>
     
using namespace std;
     
typedef long long ll;
     
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
     
#define MOD 1000000007

ll d1[200100];
ll d2[200100];


int main(){
  ll n;
  cin>>n;
  string s;
  cin>>s;
  clr(d1,0);
  clr(d2,0);
  rep(i,0,n){
    if(s[i]=='R')d1[i+5]++;
    if(s[i]=='W')d2[i+5]++;
  }
  rep(i,1,200050)d1[i]+=d1[i-1];
  rep(i,1,200050)d2[i]+=d2[i-1];
  ll mn = 1000000000LL;
  rep(i,2,200030){
    ll a = d2[i];
    ll b = d1[200040]-d1[i];
    mn = min(mn,max(a,b));
  }
  cout << mn << endl;
  return 0;
}

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

int main(void){
    int N;
    cin >> N;

    vector<int> d(N);
    for(int i=0; i<N; i++){
        cin >> d.at(i);
    }

    sort(d.begin(), d.end());
    d.erase(unique(d.begin(), d.end()), d.end());
    cout << d.size() << endl;
}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

const int MAX=1e9;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int N, K, S, C;
	cin>>N>>K>>S;
	if(S==MAX) C=MAX-1;
	else C=MAX;
	for(int i=0;i<K;i++) cout<<S<<' ';
	for(int i=K;i<N;i++) cout<<C<<' ';
	return 0;
}

Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int k=scan.nextInt();
        int x=scan.nextInt();
        if(k*500>=x)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21716
//解説あり
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>
#include <stack>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int) (v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int h, w, k, ans = 1000000000;
char s[15][1005];
int a[15][1005];

int main(void) {
  cin >> h >> w >> k;
  rep(i, 0, h) scanf("%s", s[i]);
  rep(i, 0, h) rep(j, 0, w) if (s[i][j] == '1') a[i][j+1] = 1;
  
  rep(i, 0, h) rep(j, 1, w+2) a[i][j] += a[i][j-1];
  
  for(int S=0; S<(1<<(h-1)); S++) {
    int c = 0, s = 0;
    rep(i, 1, w+2) {
      int sum = 0;
      rep(j, 0, h) {
        sum += a[j][i] - a[j][s];
        if (sum>k) {
          if (i==w+1) c = 1000000000;
          c++;
          sum = 0;
          s = i-1;
          break;
        }
        if ((S>>j) & 1) sum = 0;
      }
    }
    for (int i=0; i<h-1; i++) if ((S>>i)&1) c++;
    ans = min(ans, c);
  
  }
  
  
  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 256
"""
https://abc066.contest.atcoder.jp/tasks/abc066_b
"""
s=input()
a=0
for i in range(len(s)):
    if len(s)%2==0 and a!=0 and s[0:int(len(s)/2)]==s[int(len(s)/2):len(s)+1]:
        print(len(s))
        break
    else:
        s=s[0:len(s)-1]
    #print(s)
    a=a+1
    #print(a)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;
double const EPS = 1e-7;

typedef complex<double> P;

double dot(P a, P b) { return real(conj(a)*b); }
double cross(P a, P b) { return imag(conj(a)*b); }

int ccw(P p0, P p1, P p2) {
  auto a = p1 - p0;
  auto b = p2 - p0;
  if(cross(a, b) > EPS) return +1;
  if(cross(a, b) < -EPS) return -1;
  if(dot(a, b) < -EPS) return +2;
  if(norm(a) < norm(b)) return -2;
  return 0;
}

double area(vector<P> &g) {
  double ret = 0;
  rep(i, g.size()) {
    ret += cross(g[i], g[(i+1)%g.size()]);
  }
  return abs(ret) / 2.0;
}

struct Line: public vector<P> {
  Line(P a, P b) {
    push_back(a), push_back(b);
  }
};

Line perpendicular_bisector(P& a, P& b) {
  P c = (a + b) / 2.0;
  P p = P(c.real() + (a.imag() - b.imag()), c.imag() - (a.real() - b.real()));
  return Line(c, p);
}

P crosspointLL(Line const& a, Line const& b) {
  P va = a[1] - a[0], vb = b[1] - b[0];
  double d = cross(vb, va);
  if(abs(d) < EPS) return b[0];
  return a[0] + va * cross(vb, b[1] - a[0]) * (1.0 / d);
}

vector<P> convex_cut(vector<P>& g, Line const& l) {
  vector<P> ret;
  rep(i, g.size()) {
    if(ccw(l[0], l[1], g[i]) != -1) ret.push_back(g[i]);
    if(ccw(l[0], l[1], g[i]) * ccw(l[0], l[1], g[(i+1)%g.size()]) < 0) {
      ret.push_back(crosspointLL(Line(g[i], g[(i+1)%g.size()]), l));
    }
  }
  return ret;
}

int main() {

  int N, M;
  while(cin >> N >> M && (N|M)) {
    vector<P> g;
    rep(i, N) {
      double x, y; cin >> x >> y;
      g.push_back(P(x, y));
    }

    vector<P> ps;
    rep(i, M) {
      double x, y; cin >> x >> y;
      ps.push_back(P(x, y));
    }

    rep(i, M) {
      auto p = g;
      rep(j, M) {
        if(i == j) continue;
        p = convex_cut(p, perpendicular_bisector(ps[i], ps[j]));
      }
      printf("%.10f\n", area(p));
    }
  }

  return 0;
}

Measured memory_bytes: 3196
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num1 = sc.nextInt();
		int num2 = sc.nextInt();
		int num3 = sc.nextInt();
		List<Integer> numlist = Arrays.asList(num1, num2, num3);
		Collections.sort(numlist);
		if (numlist.get(0) != numlist.get(1) && numlist.get(1) != numlist.get(2)) {
			System.out.println("No");
		} else if (numlist.get(0) == numlist.get(1) && numlist.get(1) == numlist.get(2)) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
		
	}

}


Measured memory_bytes: 23764
S=list(input())
N=len(S)
lst=[]
for i in range(N-2):
    a=int(S[i])*100+int(S[i+1])*10+int(S[i+2])
    b=int(a)
    lst.append(b)

ans=map(lambda x: abs(x-753),lst)
print(min(ans))

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list> 
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<fstream>
#include<set>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define B begin()
#define E end()
#define S size()
#define m9 1000000007
using namespace std;
 
 

 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
 
/*
ll gcdextended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; 
    int gcd = gcdextended(b%a, a, &x1, &y1); 
   
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}
 
 
///RELATIVE COPRIME
ll modinverse(ll a, ll m) 
{ 
    ll x, y; 
   ll g = gcdextended(a, m, &x, &y); 
    if (g != 1) 
return -1;
    else
    { 
        ll res = (x%m + m) % m; 
        return res;  
    } 
} 
  */
ll powmod(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = powmod(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 
///M IS PRIME
ll modif(ll x,ll m){
return(powmod(x,m-2,m));
 
}
 
 
 
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pin(a) for(auto x:a)cout<<x<<" ";cout<<endl
#define fck(a) cout<<a;exit(0)
#define vvll vector<vector<ll> >
#define A(b) b.begin(),b.end()
#define vpi std::vector<pll>
#include <array>
#include <stack>
//include<bits/stdc++.h>
 
 
bool fa(vll &x,vll &y){return x[0]<y[0];}
bool fa1(vll &x,vll &y){return x[1]<y[1];}
bool f1(pll &x,pll &y){return x.second>y.second;}
bool f2(pll &x,pll &y){
    return x.first>y.first;
}
 
 
bool f3(ll &x,ll &y){
    return x>y; 
    }








const ll maxn=2e5+2;


int main()
{ fastio;
//freopen("test_input (1).txt", "r", stdin); 
//freopen("output.txt", "w", stdout);
ll c;cin>>c;
if(c>=30){
    cout<<"Yes\n";
}
else {
    cout<<"No\n";
}







return 0;
}




  










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

string s,t;
int dp[1001][1001];

int main(){
 ios::sync_with_stdio(false);
 cin.tie(0);
 cin>>s>>t;
 int n=(int)s.length();
 int m=(int)t.length();
 for(int i=0;i<=n;i++){
  dp[i][0]=i;
 }
 for(int j=0;j<=m;j++){
  dp[0][j]=j;
 }
 for(int i=0;i<n;i++){
  for(int j=0;j<m;j++){
   dp[i+1][j+1]=min(dp[i][j]+(s[i]!=t[j]),min(dp[i][j+1]+1,dp[i+1][j]+1));
  }
 }
 cout<<dp[n][m]<<"\n";
 return 0;
}

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

using namespace std;

typedef long long ll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define mp make_pair
#define pb push_back
#define all(name) (name.begin(), name.end())
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod);
#define mod_in(a) power(a, mod-2)
#define ncr(n, r) ((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod)
#define deb(x) cout << #x << " " << x << endl;

class Dsu {
	vector<int> drr;
	vector<int> size_arr;
	public :
	Dsu (int n) {
		rep(i, 0, n+1){
			drr.pb(i);
			size_arr.pb(1);
		}
	}

	int f_p (int a) {
		return drr[a] == a ? a : f_p(drr[a]);
	}

	ll size (int a) {
		return (ll)size_arr[f_p(a)];
	}

	void uni(int a, int b) {
		int ap = f_p(a);
		int bp = f_p(b);
		if(ap == bp)return;
		if(!(size_arr[ap] > size_arr[bp]))swap(ap,bp);
		drr[bp] = ap;
		size_arr[ap] += size_arr[bp];
	}
};



vector<ll> ft(1, 1LL);
vector<bool> is_prime(1000000, 1);

void sieve();
ll power(ll x, ll y);

int main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	sieve();
	int t = 1;
	// cin >> t;
	while(t--)
	{
		ll n, m, in1, in2;
      cin >> n >> m;
      cout << (n*(n-1))/2 + (m*(m-1))/2 << endl;
	}
}
//
//
//
//
//
//important funct
ll power(ll x, ll y) {
    ll res = 1;x %= mod;
    while (y > 0) {
        if (y & 1)res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
void sieve(){
	is_prime[0] = is_prime[1] = 0;
	for(int i = 2; i*i <= 1000000; i++)
		if(is_prime[i])
			repc(j, i*i, 1000000, i)is_prime[j] = 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/

int n,k,a[114514];
int dp[60][2];
bool bit[60];
int o[60],z[60];
signed main() {
	cin>>n>>k;
	rep(i,n){
		cin>>a[i];
		rep(j,50){
			if((a[i]>>j)&1ll)o[j]++;
			else z[j]++;
		}
	}
	if(!k){
		int ans=0;rep(i,n)ans+=a[i];
		cout<<ans<<endl;return 0;
	}
	rep(i,50){
		if((k>>i)&1ll){
			bit[i]=true;
		}
	}
	rep(i,55)dp[i][0]=dp[i][1]=-1;
	dp[50][0]=0;
	for(int i=49;i>=0;i--){
		int p=1ll<<i;
		if(dp[i+1][1]!=-1)dp[i][1]=dp[i+1][1]+p*max(o[i],z[i]);
		if(dp[i+1][0]!=-1){
			if(bit[i]){
				dp[i][0]=dp[i+1][0]+p*z[i];
				chmax(dp[i][1],dp[i+1][0]+p*o[i]);
			}else {
				dp[i][0]=dp[i+1][0]+p*o[i];
			}
		}
	}
	cout<<max(dp[0][0],dp[0][1])<<endl;
}


Measured memory_bytes: 1024
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	ll a[n];
	rep(i,0,n){
		cin >> a[i];
	}
	ll z=0;
	ll ans=0;
	for(ll i=0; i<n; i++){
		if(a[i]>=a[i+1]) {z++;ans=max(ans,z);}
		else{
			z=0;
		}
	}
	cout << ans;
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
///////////////////////////////////////////////
int main(){
	string s,t;
	getline(cin,s);
	getline(cin,t);

	int N = s.length();
	int M = t.length();
	
	s = " " + s;
	t = " " + t;

	static int dp[3002][3002] = {};

	REP(i,N+1){
		REP(j,M+1){
			if (i * j == 0) {
				dp[i][j] = 0;
			}else if (s[i] == t[j]) {
				dp[i][j] = dp[i-1][j-1] + 1;
			}else{
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}

	vector<char> ans;
	int i1,i2;
	i1 = N, i2 = M;

	while(i1 * i2 != 0){
		
		if ((dp[i1][i2] == dp[i1-1][i2-1] + 1) and (s[i1] == t[i2])){
			ans.PB(s[i1]);
			i1 = i1-1; i2 = i2-1;
		}else{
			if (dp[i1][i2-1] <= dp[i1-1][i2]){
				i1 = i1-1; i2 = i2;
			}else{
				i1 = i1; i2 = i2-1;
			}
		}
	}

	REPr(i,ans.size()){
		cout << ans[i];
	}
	cout << "\n";

	//PRINTD(dp[N][M]);
}


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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll llinf = LLONG_MAX;
const ull ullinf = ULLONG_MAX;

int n, k;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;
#endif
  cin >> n;
  int res = 0;
  string s = to_string(n);
  for (int i = 0; i < (int)s.size(); i++) {
    res += s[i] - '0';
  }
  if (n % res == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}


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

using namespace std;

const int N = 200010;
const int INF = 2e9;

int q;
vector<int> val;
pair<int, int> a[N];

struct BIT {
    long long t[N];

    void add(int x, int v) {
        while (x < N) {
            t[x] += v;
            x += (x & -x);
        }
    }
    long long get(int x) {
        long long res = 0;
        while (x) {
            res += t[x];
            x -= x & -x;
        }
        return res;
    }
} t, tx;

struct IT {
    int t[N << 2];

    void add(int node, int l, int r, int x) {
        if (x > r || x < l) return;
        if (l == r) {
            t[node]++;
            return;
        }
        int m = l + r >> 1;
        add(node << 1, l, m, x);
        add(node << 1 | 1, m + 1, r, x);
        t[node] = t[node << 1] + t[node << 1 | 1];
    }

    int get(int node, int l, int r, int need) {
        if (l == r) return l;
        int m = l + r >> 1;
        if (t[node << 1] <= need) return get(node << 1 | 1, m + 1, r, need - t[node << 1]);
        return get(node << 1, l, m, need);
    }
} it;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> q;
    for (int i = 1; i <= q; i++) {
        int op;
        cin >> op;
        if (op == 1) {
            cin >> a[i].first >> a[i].second;
            val.push_back(a[i].first);
        } else {
            a[i] = {INF, INF};
        }
    }
    val.push_back(-INF);
    sort(val.begin(), val.end());
    int n = val.size() - 1;
    long long delta = 0;
    for (int i = 1; i <= q; i++) {
        if (a[i].first == INF) {    
            int tot = it.t[1] - 1;
            int id = it.get(1, 1, n, tot / 2);

            long long res = delta;
            res += t.get(id);
            res += 1ll * val[id] * tx.get(id);
            cout << val[id] << ' ' << res << '\n';
        } else {
            int pos = lower_bound(val.begin(), val.end(), a[i].first) - val.begin();
            it.add(1, 1, n, pos);

            tx.add(1, -1);
            tx.add(pos, 2);
            t.add(1, a[i].first);
            t.add(pos, -2 * a[i].first);
            delta += a[i].second;
        }
    }
    return 0;
}

Measured memory_bytes: 9848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    long double a, b, c;
    cin >> a >> b >> c;
    if (pow(a, 0.5) + pow(b, 0.5) + 1e-15 < pow(c, 0.5))
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 512
import java.util.Scanner;

fun main (args : Array<String>) {
  val input = Scanner(System.`in`)
  
  while (input.hasNext()) {
    val N = input.nextInt()
    val S = input.next().toCharArray()
    
    for (i in 0..(S.size - 1)) {
      S[i] = 'A' + ((S[i] - 'A' + N) % 26);
    }
    
    println(S)
  }
}

Measured memory_bytes: 36580
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX
typedef pair<long long, long long> P;
int main(){
    long long k;
    cin>>k;
    cout<<((k/2)*((k+1)/2))<<endl;
   
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;
vvll lis(0, vll(3));

void dfs(ll a, vll p, ll C){
    if(a == 3){
        lis.emplace_back(p);
        return;
    }
    rep(i, 1, C+1){
        vll f = p;
        f.emplace_back(i);
        dfs(a+1, f, C);
    }
}

int main(){
    ll N, C; cin >> N >> C;
    ll D[C+1][C+1];
    rep(i, 1, C+1){
        rep(j, 1, C+1){
            cin >> D[i][j];
        }
    }
    ll c[N+1][N+1];
    rep(i, 1, N+1){
        rep(j, 1, N+1){
            cin >> c[i][j];
        }
    }
    vector<P> c0(0), c1(0), c2(0);
    vll C0(C+1, 0), C1(C+1, 0), C2(C+1, 0);
    rep(i, 1, N+1){
        rep(j, 1, N+1){
            if((i+j)%3==0){
                C0[c[i][j]]++;
            }else if((i+j)%3==1){
                C1[c[i][j]]++;
            }else{
                C2[c[i][j]]++;
            }
        }
    }
    rep(i, 1, C+1){
        if(C0[i] > 0){
            c0.emplace_back(mp(i, C0[i]));
        }
        if(C1[i] > 0){
            c1.emplace_back(mp(i, C1[i]));
        }
        if(C2[i] > 0){
            c2.emplace_back(mp(i, C2[i]));
        }
    }
    vll t(0);
    dfs(0, t, C);
    ll ans = 10000000000000;
    for(auto x: lis){
        if(x[0]==x[1]||x[0]==x[2]||x[1]==x[2]){
            continue;
        }else{
            ll m = 0;
            for(auto y: c0){
                ll s = y.first, t = y.second;
                if(x[0] != s){
                    m += t*D[s][x[0]];
                }
            }
            for(auto y: c1){
                ll s = y.first, t = y.second;
                if(x[1] != s){
                    m += t*D[s][x[1]];
                }
            }
            for(auto y: c2){
                ll s = y.first, t = y.second;
                if(x[2] != s){
                    m += t*D[s][x[2]];
                }
            }
            ans = min(m, ans);
        }
    }
    prt(ans);
}

Measured memory_bytes: 3640
import java.util.Scanner;
public class Main {

  public static double height(int a, double area) {
    return 2 * (area / a);
  }

  public static double area(int a, int b, double c, double perimeter) {
    double halfP = perimeter / 2;
    return Math.pow(halfP * (halfP - a) * (halfP - b) * (halfP - c), .5);
  }

  public static double perimeter(int a, int b, double c) {
    return a + b + c;
  }

  public static double missingLength(int a, int b, int C) {
    return Math.pow(Math.pow(a, 2) + Math.pow(b, 2) - (2*a*b*Math.cos(Math.toRadians(C))), .5);
  }

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt();
    int b = s.nextInt();
    int C = s.nextInt();
    double c = missingLength(a, b, C);
    double perimeter = perimeter(a, b, c);
    double area = area(a, b, c, perimeter);
    double height = height(a, area);
    System.out.println(area);
    System.out.println(perimeter);
    System.out.println(height);
    s.close();
  }

}



Measured memory_bytes: 26324
using System;
class Program{
	static int n;
	static long ans,b;
	static int[] s; 
	static void Main(){
		n=int.Parse(Console.ReadLine());
		s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		int[] a=new int[n];
		for(int i=0;i<n;i++){a[i]=s[i];}
		if(s[0]==0){s[0]=fu(1);ans++;}
		for(int i=1;i<n;i++){
			s[i]+=s[i-1];
			if(s[i]==0){s[i]=-Math.Sign(s[i-1]);ans++;}
			else if(Math.Sign(s[i])==Math.Sign(s[i-1])){
				ans+=Math.Abs(s[i])+1;
				s[i]=-Math.Sign(s[i]);
			}
		}
		b+=Math.Abs(a[0])+1;
		a[0]=-Math.Sign(s[0]);
		for(int i=1;i<n;i++){
			a[i]+=a[i-1];
			if(a[i]==0){a[i]=-Math.Sign(a[i-1]);b++;}
			else if(Math.Sign(a[i])==Math.Sign(a[i-1])){
				b+=Math.Abs(a[i])+1;
				a[i]=-Math.Sign(a[i]);
			}
		}
		Console.WriteLine("{0}",Math.Min(ans,b));
	}
	static int fu(int z){
		if(z==n){return 1;}
		else if(s[z]==0){s[z]=fu(z+1);ans++;}
		return s[z]<0?1:-1;
	}
}

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

A = sorted(A)
sign = 0
for i in range(1,len(A)-1):
    if A[i-1] == A[i] or A[i] == A[i+1]:
        sign = 1

if N == 2 and A[0] == A[1]:
    sign = 1

if sign == 1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 88404
def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
    g = [[] for _ in [0]*n]
    [g[a].append(b) for a, b in ab]
    [g[b].append(a) for a, b in ab]
    for i in range(n):
        if len(g[i]) > 2:
            root = i
            break
    else:
        print(1)
        return
    d = [-1]*n  # 根からの距離
    d[root] = 0
    q = [root]
    cnt = 0
    while q:  # BFS
        cnt += 1
        qq = []
        while q:
            i = q.pop()
            for j in g[i]:
                if d[j] == -1:
                    d[j] = cnt
                    qq.append(j)
        q = qq
    d2 = sorted([(j, i) for i, j in enumerate(d)])[::-1]
    stock = [0]*n
    ans = 0
    for _, i in d2:
        dist = d[i]
        s = 0
        cnt = 0
        for j in g[i]:
            if dist < d[j]:
                s += stock[j]
                cnt += 1
        ans += max(cnt-s-1, 0)
        s += max(cnt-s-1, 0)
        if s > 0 or cnt > 1:
            stock[i] = 1
    print(ans)


main()


Measured memory_bytes: 50004
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int n;
int a[15];
bool check(int x) {
	int l = 1;
	int ta[4]; ta[0] = -1, ta[1] = 0, ta[2] = 1;
	for (int i = 1; i <= n; i++) {
		int b = x % 3;
		if((a[l] + ta[b]) % 2 == 0) return true;
		l++;
		x /= 3;
	}
	return false;
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	int all = 1;
	for (int i = 1; i <= n; i++) all = all * 3;
	int ans = 0;
	for (int i = 0; i <= all -1; i++) {
		if(check(i)) ans++;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 128
s = input().strip()
if not ('S' in s and 'N' in s) and ('S' in s or 'N' in s):
        print('No')
        exit()

if not ('E' in s and 'W' in s) and ('E' in s or 'W' in s):
        print('No')
        exit()

 
print('Yes')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	int cnt=0;
	cin>>a>>b;
	if(a>0&&b>0)cout<<"Positive";
	if(a<0&&b<0)
	{
		for(int i=a;i<=b;i++)cnt++;
		if(cnt&1)cout<<"Negative";
		else cout<<"Positive";
	}
	if(a<=0&&b>=0)cout<<"Zero";
	return 0;
}

Measured memory_bytes: 256