akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define ld long double
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define pll pair<ll,ll>
    #define ff first
    #define ss second
    #define pb push_back
    #define deb(x) cout<<#x<<" : "<<x<<endl;
    #define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
    #define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
    #define deb4(w,x,y,z) cout<<#w<<" : "<<w<<"\t"<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
    #define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define printv(a)  for(ll i=0;i<a.size();i++)  cout<<a[i]<<" ";
   
   
    const int mod=998244353.;
    const int N=1e6+5; 
   
    bool sortbysec(const pair<pair<ll,ll>,ll> &a, 
                      const pair<pair<ll,ll>,ll> &b) 
        { 
            return (a.second > b.second); 
        } 
        ll powermod(ll x, ll y, ll p)
        {
            ll res = 1;
            x = x % p;
            while (y > 0)
            {
                if (y & 1) res = (res*x) % p;
                y = y>>1;
                x = (x*x) % p;
            }
            return res;
        }
       
        bool isprime(int n) 
        { 
            if (n <= 1)  return false; 
            if (n <= 3)  return true; 
            if (n%2 == 0 || n%3 == 0) return false; 
            for (int i=5; i*i<=n; i=i+6) 
                if (n%i == 0 || n%(i+2) == 0) 
                   return false; 
           return true; 
        }
        
        int main()
        {
            FAST;
          ld a,b,c;
          cin>>a>>b>>c;
           ld x;
           x=a*b;
           x=sqrtl(x);
           x*=2;
           ll y=c-(a+b);
           if(x<y)
           cout<<"Yes";
           else cout<<"No";
          
            return 0;
        }

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

#define ull unsigned long long

#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

bool isPalindrome(string s) {
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main(void) {
    string input[3];
    cin >> input[0] >> input[1] >> input[2];
    cout << input[0][0] << input[1][1] << input[2][2] << endl;
    return 0;
}


Measured memory_bytes: 256
def resolve():
        N = int(input())
        v = list(map(int, input().split()))
        V = sorted(v)
        one = (V[0] + V[1]) / 2
        ans = [one]
        for i in range(2, N):
            ans.append((ans[i-2] + V[i]) / 2)
        print(ans[-1])
resolve()

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

int main() {
  int n, k;
  cin >> n >> k;
  if ((n+1) / 2 >= k) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dumplist_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll n, k;
        cin >> n >> k;
        if ((n - 1) * (n - 2) / 2 < k) {
            cout << -1 << endl;
            return 0;
        }

        v<v<bool>> used(n, v<bool>(n, true));
        ll m = n * (n - 1) / 2;
        ll count = 0;
        rep(i, n - 1) {
            for (long long j = i + 1; j < n - 1; ++j) {
                if (count < k) {
                    count++;
                    m--;
                    used[i][j] = false;
                }
            }
        }

        cout << m << endl;
        rep(i, n - 1) {
            for (long long j = i + 1; j < n; ++j) {
                if (used[i][j]) {
                    cout << i + 1 << " " << j + 1 << endl;
                }
            }
        }


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s[1000],s1,s2;
vvl v;
//vl vis,d;
ll f[300001];
ll inv[300001];

ll dis(ll x, ll y, ll p, ll q){
    ll a=abs(x-p),b=abs(y-q);
    return f[a+b]*inv[a]%mod*inv[b]%mod; 
}
ll dp[4000];
int main() {
    IOS;
    f[0]=1;
    fo(i,300000)f[i+1]=f[i]*(i+1)%mod;
    inv[300000]=bpow(f[300000],mod-2,mod);
    for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
    cin>>n>>k>>h;
    vpl a(h);fo(i,h)cin>>a[i].ff>>a[i].ss;
    sort(all(a));
    fo(i,h){
        p=dis(1,1,a[i].ff,a[i].ss)%mod;q=0;
        for(int j=i-1;j>=0;j--){
            if(a[j].ff<=a[i].ff&&a[j].ss<=a[i].ss)q=(q+dp[j]*dis(a[j].ff,a[j].ss,a[i].ff,a[i].ss)%mod)%mod;
        }
        dp[i]=(p-q+mod)%mod;
        kv+=dp[i]*dis(a[i].ff,a[i].ss,n,k)%mod;kv%=mod;
    }
    //cout<<kv<<el;
    cout<<(dis(1,1,n,k)-kv+mod)%mod;
    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    auto check=[&](ll x){
        ll numc=2*x;
        ll tmp1=n,tmp2=m;
        if(numc>tmp2) return false;
        tmp2-=numc;
        tmp1+=tmp2/2;
        return tmp1>=x;
    };
    ll ok=0,ng=inf,mid;
    while(ng-ok>1){
        mid=(ok+ng)/2;
        if(check(mid)) ok=mid;
        else ng=mid;
    }
    cout<<ok<<endl;
}

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

int is_snake_a( char * s, int snake_size )
{
	int i = 2, eq_num = 0;
	while ( s[i] == '=' ) { i++; eq_num++; }
	if ( eq_num == 0 ) { return 0; }
	if ( s[i] != '#' ) { return 0; } i++; // #の場合は位置を1つ進める
	while ( s[i] == '=' ) { i++; eq_num--; }
	if ( eq_num != 0 ) { return 0; }
	if ( s[i] == '~' && s[i+1] == '\0' ) { return 1; } 
	return 0;
}

int is_snake_b( char * s, int snake_size )
{
	int i = 2;

	while ( s[i] == 'Q' && s[i+1] == '=' ) { i+=2; } // Q=が続く限り位置を進める
	if ( i == 2 ) { return 0; }
	if ( s[i] == '~' && s[i+1] == '~' && s[i+2] == '\0' ) { return 1; }
	return 0;
}

int main()
{
	char snake[201];
	int num = 0;

	scanf( "%d", &num );
	while ( num > 0 ) {
		scanf( "%s", snake );

		if ( strlen( snake ) < 2 ) {
			printf( "NA\n" );
		} else if ( snake[0] == '>' && snake[1] == '\'' ) {
			if ( is_snake_a( snake, strlen( snake ) ) == 1 ) {
				printf( "A\n" );
			} else {
				printf( "NA\n" );
			}
		} else if ( snake[0] == '>' && snake[1] == '^' ) {
			if ( is_snake_b( snake, strlen( snake ) ) == 1 ) {
				printf( "B\n" );
			} else {
				printf( "NA\n" );
			}
		} else {
			printf( "NA\n" );
		}
		num--;
	}

	return 0;
}



Measured memory_bytes: 1984
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<list>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
#include<memory.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int len=s.length();
	cout<<s[0]<<len-2<<s[len-1]<<endl;
	return 0;
}


Measured memory_bytes: 256
from bisect import bisect, bisect_left
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

ans = 0
for i in B:
    max_A = bisect(A, i-1)
    min_C = bisect_left(C, i+1)
    # print("m_A", max_A, "m_C", min_C)
    ans += (max_A)* (len(C) - min_C)
print(ans)

Measured memory_bytes: 23232
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] s = scanner.next().toCharArray();
		char[] r = new char[s.length];
		for (int i = s.length - 1, j = 0; i >= 0; i--, j++) {
			r[j] = s[i];
		}
		System.out.println(r);
	}
}

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

int main() {
  int N;
  int64_t K;
  cin>>N>>K;
  vector<int>to(N);
  vector<int>check(N);
  map<int,int>town;
  map<int,int>rev;
  for(int i=0;i<N;i++){
    cin>>to.at(i);
  }
  int x=1;
  int count=0;
  while(check.at(x-1)==0 && K>0){
    check.at(x-1)=1;
    town[x]=count;
    rev[count]=x;
    x=to.at(x-1);
    K--;
    count++;
  }
  if(K==0){
    cout<<x<<endl;
  }
  else{
    int y=town.at(x);
    int r=count-y;
    K=(K)%r;
    K=y+K;
    x=rev.at((int)K);
    cout<<x<<endl;
  }
    
}

Measured memory_bytes: 19808
import java.io.PrintWriter;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        String s = sc.next();
        char[] arr = s.toCharArray();

        if ((arr[2]==arr[3]) && (arr[4]==arr[5])) {
            out.print("Yes");
            out.flush();
            return;
        }


        out.print("No");
        out.flush();



    }

}


Measured memory_bytes: 23764
from collections import defaultdict
from heapq import heappop, heappush


class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]


g = Graph()

N = int(input())

rows = []
cols = []
weights = []

for _ in range(N-1):
    # u v 間のコスト
    u, v, a = [int(i) for i in input().split()]
    g.add_edge(u-1, v-1, a)
    g.add_edge(v-1, u-1, a)

Q, K = [int(i) for i in input().split()]
d = Dijkstra(g, K-1)

#print(g)
#print(d.dist)
for i in range(Q):
    x, y = [int(i) for i in input().split()]
    print(d.dist[x-1]+d.dist[y-1])


Measured memory_bytes: 123224
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  vector<pll> a(n);
  for(ll i=0;i<n;i++) {
    ll v;
    cin >> v;
    a[i]={v,i};
  }
  sort(a.rbegin(),a.rend());
  set<ll> al,ar;
  al.insert(a[0].second);
  ll ans=0;
  for(ll i=1;i<n;i++) {
    ll v=a[i].first;
    ll id=a[i].second;
    vec l(2,-1),r(2,n);
    al.insert(id);
    auto it=al.find(id);
    for(ll i=0;i<2;i++) {
      if(it==al.begin()) break;
      l[i]=*--it;
    }
    it=al.find(id);
    for(ll i=0;i<2;i++) {
      if(++it==al.end()) break;
      r[i]=*it;
    }
    ans+=v*(r[1]-r[0])*(id-l[0]);
    ans+=v*(r[0]-id)*(l[0]-l[1]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 9568
#include <iostream>
using namespace std;
int partition(int a[],int n){
    int i,j,v,x;
    v=n-1;
    x=a[v];
    j=0;
    for(i=0;i<n;i++){
        if(a[i]<=x)swap(a[i],a[j++]);
    }
    return j-1;
}

int main(void){
    int i,n,v,a[100000+1];
    cin>>n;
    for(i=0;i<n;i++)cin>>a[i];
    v=partition(a,n);
    for(i=0;i<n;i++){
        if(i==v)cout<<"["<<a[i]<<"]";
        else cout<<a[i];
        i==n-1 ? cout<<endl:cout<<" ";
    }
    return 0;
}

Measured memory_bytes: 3480
#include<iostream>
#include<vector>
using namespace std;
const long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long F[2<<17],I[2<<17];
int N;
vector<int>G[2<<17];
pair<int,long>dp1[2<<17];
long ans[2<<17];
pair<int,long>dfs1(int u,int p)
{
	pair<int,long>ret=make_pair(0,1);
	for(int v:G[u])
	{
		if(v==p)continue;
		pair<int,long>q=dfs1(v,u);
		ret.first+=q.first;
		(ret.second*=q.second*I[q.first]%mod)%=mod;
	}
	(ret.second*=F[ret.first++])%=mod;
	dp1[u]=ret;
	return ret;
}
void dfs2(int u,int p,pair<int,long>pr)
{
	pair<int,long>ret=dp1[u];
	ans[u]=ret.second*I[ret.first-1]%mod;
	(ans[u]*=pr.second*I[pr.first]%mod)%=mod;
	for(int v:G[u])
	{
		if(v==p)continue;
		pair<int,long>nxt;
		nxt.first=N-dp1[v].first;
		nxt.second=ans[u]*power(dp1[v].second,mod-2)%mod*F[dp1[v].first]%mod*F[nxt.first-1]%mod;
		dfs2(v,u,nxt);
	}
	(ans[u]*=F[ret.first-1+pr.first])%=mod;
}
main()
{
	F[0]=1;
	for(int i=1;i<2<<17;i++)F[i]=F[i-1]*i%mod;
	I[(2<<17)-1]=power(F[(2<<17)-1],mod-2);
	for(int i=(2<<17)-1;i--;)I[i]=I[i+1]*(i+1)%mod;
	cin>>N;
	for(int i=1;i<N;i++)
	{
		int u,v;cin>>u>>v;
		u--,v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs1(0,-1);
	dfs2(0,-1,make_pair(0,1));
	for(int i=0;i<N;i++)
	{
		cout<<ans[i]<<endl;
	}
}


Measured memory_bytes: 25204
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

const double EPS = 10e-10;
const double pi = 3.14159265358979;

double add(double a, double b){
    if(abs(a+b) < EPS*(abs(a)+abs(b))) return 0;
    return a+b;
}

struct P{
    double x, y;
    P(){}
    P(double x, double y) :x(x), y(y){}
    P operator + (P p){
        return P(add(x, p.x), add(y, p.y));
    }
    P operator - (P p){
        return P(add(x, -p.x), add(y, -p.y));
    }
    P operator * (double d){
        return P(x*d, y*d);
    }
    double dot(P p){
        return add(x*p.x, y*p.y);
    }
    double det(P p){
        return add(x*p.y, -y*p.x);
    }
};

bool comp_x(const P& p, const P& q){
    if(p.x != q.x) return p.x < q.x;
    return p.y < q.y;
}

double dist(P p, P q){
    return (p-q).dot(p-q);
}

vector<P> convex_hull(P* ps, int n){
    sort(ps, ps+n, comp_x);
    int k = 0;
    vector<P> qs(n*2);
    for(int i = 0; i < n; i++){
        while(k > 1 && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0) k--;
        qs[k++] = ps[i];
    }
    for(int i = n-2, t = k; i >= 0; i--){
        while(k > t && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0) k--;
        qs[k++] = ps[i];
    }
    qs.resize(k-1);
    return qs;
}

int main(){
    int N;
    P p[100];
    P q[100];
    cin >> N;
    for(int i = 0; i <  N; i++){
        cin >> p[i].x >> p[i].y;
        q[i].x = p[i].x;
        q[i].y = p[i].y;
    }
    if(N == 2){
        cout << 0.5 << endl;
        cout << 0.5 << endl;
        return 0;
    }
    vector<P> conv = convex_hull(p, N);
    int n = conv.size();
    vector<double> prob(n);
    for(int i = 1; i <= n-2; i++){
        double inner_prod = (conv[i-1]-conv[i]).dot(conv[i+1]-conv[i]);
        double norm = sqrt(dist(conv[i-1], conv[i])*dist(conv[i+1], conv[i]));
        prob[i] = (pi - acos(inner_prod/norm))/(2*pi);
    }
    double inner_prod = (conv[n-1]-conv[0]).dot(conv[1]-conv[0]);
    double norm = sqrt(dist(conv[n-1], conv[0])*dist(conv[1], conv[0]));
    prob[0] = (pi - acos(inner_prod/norm))/(2*pi);
    inner_prod = (conv[n-2]-conv[n-1]).dot(conv[0]-conv[n-1]);
    norm = sqrt(dist(conv[n-2], conv[n-1])*dist(conv[0], conv[n-1]));
    prob[n-1] = (pi - acos(inner_prod/norm))/(2*pi);
    
    for(int i = 0; i < N; i++){
        //cout << i << ' ' << q[i].x << ' ' << q[i].y << endl;
        for(int j = 0; j < n; j++){
            if(q[i].x == conv[j].x && q[i].y == conv[j].y){
                //cout << conv[j].x << ' ' << conv[j].y << endl;
                cout << prob[j] << endl;
                break;
            }
            if(j == n-1){
                cout << 0 << endl;
            }
        }
    }
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n,a,d,m,k;
	cin>>n>>a>>d>>m;
	vi x(m),y(m),z(m);
	rep(i,0,m){
		cin>>x[i]>>y[i]>>z[i];
	}
	cin>>k;
	int ind=k;
	for(int i=m-1;i>=0;i--){
		if(x[i]==0 && y[i]<=ind && ind<=z[i]){
			ind=z[i]+y[i]-ind;
		}
	}
	int now=0;
	now=a+d*(ind-1);
	rep(i,0,m){
		if(y[i]<=ind && ind<=z[i]){
			if(x[i]==0){
				ind=z[i]+y[i]-ind;
			}else if(x[i]==1){
				now++;
			}else if(x[i]==2){
				now/=2;
			}
		}
	}
	o(now);
}

Measured memory_bytes: 3116
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, long long> pdl;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007

ll power(ll a, ll b) {
	if (b == 0) return 1;
	ll pp = power(a, b/2);
	pp = (pp*pp) % mod;
	if(b%2 == 0) return pp;
	return (pp*a)%mod;
}

int dist[1<<20];
int front[1<<20];
int back[1<<20];

int main() {
    //freopen("input.in","r",stdin);
  	//freopen("output.out","w",stdout);
	int N, D;
	cin>>N>>D;
	rep(i, N) cin>>dist[i];
	front[0] = D;
	rep(i, N-1) {
		// front[i] dist[i]
		if(dist[i] >= 2*front[i]) front[i+1] = front[i];
		else front[i+1] = abs(front[i]-dist[i]);
	}

	back[N-1] = 1;
	for(int i = N-1;i > 0;i--) {
		// back[i] dist[i]
		if(dist[i] >= 2*back[i]) back[i-1] = back[i];
		else back[i-1] = back[i]+dist[i];
	}

	//rep(i, N) cout<<front[i]<<" ";cout<<endl;
	//rep(i, N) cout<<back[i]<<" ";cout<<endl;

	int Q, q;cin>>Q;
	rep(i, Q) {
		cin>>q;q--;
		if(back[q] <= front[q]) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}

	return 0;
}


Measured memory_bytes: 7936
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

int main(){
  int x;
  cin >> x;
  cout << (x + 1) % 2 << endl;
  
  return 0;
}

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

long gcd(long a, long b){
    long v0 = a, v1 = b, v2 = a % b;
    while(v2 != 0){
        v0 = v1;
        v1 = v2;
        v2 = v0 % v1;
    };
    return v1;
}

int main() {
    long N, K;
    cin>>N>>K;
    vector<long> A;
    long tmp;
    for(int i=0;i<N;++i){
        cin>>tmp;
        A.push_back(tmp);
    }
    long gcdans = A[0];
    for(int i=1;i<N;++i){
        gcdans = gcd(gcdans, A[i]);
    }
    sort(A.begin(), A.end());
    if((gcd(A[A.size()-1], K) % gcdans == 0) & (A[A.size()-1] >= K)){
        cout<<"POSSIBLE"<<endl;
    }
    else {
        cout<<"IMPOSSIBLE"<<endl;
    }
}


Measured memory_bytes: 1400
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author vdewansa
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        GLongestPath solver = new GLongestPath();
        solver.solve(1, in, out);
        out.close();
    }

    static class GLongestPath {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int M = in.nextInt();
            int[] x = new int[M + 1];
            int[] y = new int[M + 1];
            for (int e = 1; e <= M; e++) {
                x[e] = in.nextInt();
                y[e] = in.nextInt();
            }
            Graph g = new Graph(N, M, x, y);
            int res = 0;
            for (int e = 1; e <= M; e++) {
                res = Math.max(res, g.longestPath(x[e]));
            }
            out.println(res);
        }

    }

    static class Graph {
        final int N;
        final int M;
        final Map<Integer, Set<Integer>> outEdges = new HashMap<>();
        final Map<Integer, Integer> longestPathSeen = new HashMap<>();

        Graph(int n, int m, int[] from, int[] to) {
            N = n;
            M = m;
            for (int i = 1; i <= m; i++) {
                addEdge(from[i], to[i]);
            }
        }

        void addEdge(int from, int to) {
            if (!outEdges.containsKey(from)) {
                outEdges.put(from, new HashSet<>());
            }
            outEdges.get(from).add(to);
        }

        int longestPath(int vFrom) {
            if (longestPathSeen.containsKey(vFrom)) {
                return longestPathSeen.get(vFrom);
            }
            longestPathSeen.put(vFrom, 0);

            if (outEdges.containsKey(vFrom)) {
                for (int vTo : outEdges.get(vFrom)) {
                    longestPathSeen.put(vFrom, Math.max(
                            longestPathSeen.get(vFrom),
                            longestPath(vTo) + 1));
                }
            }
            return longestPathSeen.get(vFrom);
        }

    }
}



Measured memory_bytes: 143292
#include <bits/stdc++.h>
using namespace std;
int main(){
	int r,d,x;
	scanf("%d%d%d",&r,&d,&x);
	for(int i=1;i<=10;i++){
		x=x*r-d;
		printf("%d\n",x);
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define REP(i,n) for(int i=0; i< int(n); (i)++)

int main()
{
    char a[7]={0};
    int sum=0;
    scanf("%s",a);
    
    REP(i,6)
    {
        if(a[i]=='1')
        {
            sum++;
        }
    }
    printf("%d\n",sum);
    
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define LLint long long int
#define Lint long int
#define Ldouble long double

// class UnionFind;

// bool sortBySec(const pair<int, int>& a, const pair<int, int>& b);
int modExp(const int x, const int n, const int m);
// int mmi(int x, int m);

string s;
vector<int> digits;
vector<int> mod;

void solve() {
    cin >> s;
    reverse(s.begin(), s.end());
    digits = vector<int>(s.length());
    for (int i = 0; i < s.length(); i++) {
        digits[i] = s[i] - '0';
    }

    mod = vector<int>(s.length() + 1);
    mod[0] = 0;
    for (int i = 0; i < s.length(); i++) {
        mod[1 + i] = ((digits[i] * modExp(10, i, 2019)) % 2019 + mod[i]) % 2019;
    }
    map<int, int> cnt;
    for (int i : mod) {
        cnt[i]++;
    }
    int sum = 0;
    for (auto i : cnt) {
        sum += i.second * (i.second - 1) / 2;
    }

    cout << sum;
}

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

    solve();

    return EXIT_SUCCESS;
}

// Helpers.
/*
bool sortBySec(const pair<int, int>& a, const pair<int, int>& b) {
    return (a.second < b.second);
}
*/
// Modular arithmetic.

int modExp(const int x, const int n, const int m) {
    if (n == 0) {
        return 1 % m;
    }
    long long u = modExp(x, n / 2, m);
    u = (u * u) % m;
    if (n % 2 == 1) {
        u = (u * x) % m;
    }
    return u;
}

/*
int mmi(const int x, const int m) { return modExp(x, m - 2, m); }
*/
// Union find data structure.
/*
class UnionFind {
   public:
    vector<int> link;
    vector<int> size;

    UnionFind(int n) {
        link = vector<int>(n);
        size = vector<int>(n);
        for (int i = 0; i < n; i++) {
            link[i] = i;
            size[i] = 1;
        }
    }

    int find(int x) {
        while (x != link[x]) {
            x = link[x];
        }
        return x;
    }

    bool same(int a, int b) { return find(a) == find(b); }

    void unite(int a, int b) {
        a = find(a);
        b = find(b);
        if (size[a] < size[b]) {
            swap(a, b);
        }
        size[a] += size[b];
        link[b] = a;
    }
};
*/


Measured memory_bytes: 5152
#include<bits/stdc++.h> 
using namespace std;
int main()
{
     int a[1000];
     int n=0;
     cin>>a[1]>>a[2]>>a[3];
     
     while(a[1]!=a[2]||a[2]!=a[3]||a[1]!=a[3])
     {
	 sort(a+1,a+3+1);
     	if(a[2]!=a[3]) 
     	{
     		a[1]++;
     		a[2]++;
     	}
     	else a[1]+=2;
     	n++;
     }
     cout<<n;
}



Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, const char *argv[])
{
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }

  int cnt = 0;
  for (int i = 1; i < p.size() - 1; i++) {
    if (p[i - 1] < p[i] && p[i] < p[i + 1]) {
      cnt++;
    } else if (p[i - 1] > p[i] && p[i] > p[i + 1]) {
      cnt++;
    } else if (p[i - 1] == p[i + 1] && p[i] > p[i - 1]) {
      cnt++;
    }
  }

  cout << cnt << "\n";
}

Measured memory_bytes: 256
/*Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.

My little horse must think it queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.

He gives his harness bells a shake
To ask if there is some mistake.
The only other sound’s the sweep
Of easy wind and downy flake.

The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
lli modexp(lli x, lli y)
{
    lli res=1ll;
    x%=MOD;
    while(y>0ll)
    {
        if(y&1ll)
            res=(res*x)%MOD;
        y>>=1ll;
        x=(x*x)%MOD;
    }
    return res;
}
lli modinv(lli n)
{
    return modexp(n,MOD-2ll);
}
lli BinCoeff(lli n, lli r)
{
    if(r==0ll)
        return 1ll;
    lli aux[n+1];
    aux[0]=1ll;
    for(lli i=1ll;i<=n;++i)
        aux[i]=aux[i-1]*i%MOD;
    return (aux[n]*modinv(aux[r])%MOD*modinv(aux[n-r])%MOD)%MOD;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=0,m=0;lli k=0ll,sum=0ll;
    cin>>n>>m>>k;
    for(int i=0;i<n;++i)
        for(int j=0;j<m;++j)
        {
            lli x=1ll*(n-i)*(m-j);
            x%=MOD;
            x=1ll*x*(i+j);
            x%=MOD;
            if(i!=0&&j!=0)
                x*=2ll;
            sum=(sum+x)%MOD;
        }
    cout<<(1ll*sum*BinCoeff(1ll*n*m-2ll,k-2ll))%MOD<<endl;
}


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

void ti(){
  #ifndef ONLINE_JUDGE
    freopen("in.txt", "r+", stdin);
    freopen("out.txt", "w", stdout);
  #endif
}

#define ll long long
#define MIN(a, b) a < b ? a : b
#define MAX(a, b) a > b ? a : b

int a[200001];
int b[200001];

int foo(int n, int m, ll int x) {
    ll int sum = 0;
    int i = 0, j = 0;
    int count = 0;

    while (i < n) {
        sum += (ll int) a[i];
        i++;
        if (sum > x) {
            i--;
            sum -= (ll int) a[i];
            break;
        }
    }
    count = i;

    while (j < m) {
        sum += (ll int) b[j];
        j++;
        while (sum > x && i > 0) {
            i--;
            sum -= (ll int) a[i];
        }
        count = (sum <= x) ? MAX( (count), (i + j) ) : count;
    }

    return count;
}

int main(){

  // ti();
  int n, m, k; cin>>n>>m>>k;

  int i = 0;
  int j = 0;

  while(i < n){
    int a1; cin>>a1;
    a[i] = a1;
    i++;
  }

  while(j < m){
    int a2; cin>>a2;
    b[j] = a2;
    j++;
  }

  cout<<foo(n, m, k)<<endl;


  return 0;
}


Measured memory_bytes: 5136
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<utility>
using namespace std;
 
typedef long long ll;



struct unionfind{
vector<int> par;
vector<int> rank;
vector<int> siz;

	unionfind(int N) : par(N+1), rank(N+1),siz(N+1){
		for(int i=0; i<=N; i++) par[i] =i, rank[i]=0, siz[i] =1;
	}
	int root(int x){
		return par[x]==x ? x : par[x]=root(par[x]);
	}
	bool same(int x,int y){
		return root(x)==root(y);
	}
	void unite(int x, int y){
		x=root(x);
		y=root(y);
		if(x==y) return;
		
		if(rank[x] < rank[y]){
			par[x]=y;
			siz[y]+=siz[x];
		}else{
			par[y]=x;
			siz[x]+=siz[y];
			if(rank[x]==rank[y]) rank[x]=rank[x]+1;
		}
		return;
	}
	int size(int x){
		return siz[root(x)];
	}
};

int main(){
	int n,m,k;
    cin >> n >> m >> k;
    unionfind uf(n);
  	vector<int> f(n+1,0);
  	vector<int> b(n+1,0);
    
    int x,y;
    for(int i=0;i<m;i++){
    	cin >> x >> y;
        uf.unite(x,y);
        f[x]++;
        f[y]++;
    }
    for(int i=0;i<k;i++){
        cin >> x >> y;
      	if(uf.same(x,y)){
    		b[x]++;
        	b[y]++;
        }
    }
    
    for(int i=1;i<=n;i++){
    	cout << uf.size(i)-f.at(i)-b.at(i)-1 << " ";
    }
    return 0;
}

Measured memory_bytes: 2816
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;

char whichRSPcanWinTo(char ch){
	if(ch == 'r'){
		return 'p';
	}else if(ch == 'p'){
		return 's';
	}else if(ch == 's'){
		return 'r';
	}else{
		return '*';
	}
}

int main()
{
	string T;
	int n,k;
	int R,S,P;
	cin>>n>>k;
	cin>>R>>S>>P;
	cin>>T;
	char *str = new char[n];
	rep(i,n){
		str[i] = whichRSPcanWinTo(T[i]);
	}
	for(int i = 0; i < n-k; i++){
		if( str[i] != '*'){
			if(str[i] == str[i+k]){
				str[i+k] = '*';
			}
		}
	}
	ll ans = 0;
	rep(i,n){
		if( str[i] == 'r'){
			ans += R;
		}else if( str[i] == 's'){
			ans += S;
		}else if( str[i] == 'p'){
			ans += P;
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 512
//C - Boxes and Candies: 25Min;
//Assunto: AdHoc;
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int n, x, aux;
    ll ans1 = 0, ans2 = 0, ans;
    cin >> n >> x;
    vector<int> caixas(n), caixas2(n);
    loop(i, 0, n) {
        cin >> caixas[i];
        caixas2[i] = caixas[i];
    }
    loop(i, 0, n-1) {
        aux = (caixas[i] + caixas[i+1]) - x;
        if(aux < 0) aux = 0;
        ans1 += aux;
        caixas[i+1] -= aux;
        if(caixas[i+1] < 0) caixas[i+1] = 0;
        //cout << aux << "\n";
    }
    loop(i, 1, n) {
        aux = (caixas2[i] + caixas2[i-1]) - x;
        if(aux < 0) aux = 0;
        ans2 += aux;
        caixas2[i] -= aux;
        if(caixas2[i] < 0) caixas2[i] = 0;
    }
    ans = min(ans1, ans2);
    cout << ans2 << "\n";
}
    

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s) for(int i = 0; s > i; i++)
int main(void){
  int n;
  cin >> n;
  int sum = 0;
  rep(i,n){
    int a,b;
    cin >> a >> b;
    sum += (b - a) + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
bool is_prime(int n) {
    for(int i = 2; i*i <= n; i++)
        if (n%i==0)
            return false;
    return true;
}
int main() {
    int n;
    cin >> n;
    map<int, int> prime;
    for(int i = 2; i <= n; i++)
        if (is_prime(i))
            prime[i] = 0;
    for(int i = 2; i <= n; i++) {
        int num = i;
        for(auto& p: prime) {
            while (num % p.first == 0) {
                num /= p.first;
                p.second += 1;
            }
        }
    }
    // 75 = 1 * 75, 3 * 25, 5 * 15, 3 * 5 * 5
    // 75 = (4+1) * (4+1) * (2+1)
    // 75 = (74+1)
    // 75 = (2+1) * (24+1)
    // 76 = (4+1) * (14+1)
    int cnt4 = 0, cnt2 = 0;
    int cnt14 = 0, cnt24 = 0, cnt74 = 0;
    for(auto& p: prime) {
        if (p.second >= 4)
            cnt4 += 1;
        if (p.second >= 2)
            cnt2 += 1;
        if (p.second >= 14)
            cnt14 += 1;
        if (p.second >= 24)
            cnt24 += 1;
        if (p.second >= 74)
            cnt74 += 1;
        //  cout << p.first << " cnt = " << p.second << endl;
    }
    // cout << cnt4 << " " << cnt2 << endl;
    // cout << cnt4*(cnt4-1) / 2 * (cnt2-2) << endl;
    int ans = 0;
    // nCr(cnt4, 2) * (cnt4+cnt2-2);
    ans += cnt4*(cnt4-1) / 2 * (cnt2-2); // 3, 5, 5
    ans += cnt74;
    ans += cnt24 * (cnt2-1);
    ans += cnt14 * (cnt4-1);
    cout << ans << endl;


    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD (int)1e9+7
#define EPS 1e-8
#define INF 1e9+10
#define INFL 1e18
typedef long long ll;
using namespace std;
int main()
{
  string s;
  cin >> s;
  int itr = 0;
  string c ="CF";
  rep(i,s.size()){
      if(s[i]==c[itr]){
          if(itr==1){
              cout << "Yes" << endl;return 0;
          }
          itr++;
      }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define maxn 3005
#define inv 500000004
#define mod 1000000007

using namespace std;

int n,q,a[maxn];
int dp[maxn][maxn];


signed main()
{
	cin>>n>>q;
	for(int i=1;i<=n;i++)	cin>>a[i];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(a[i]<a[j])	dp[i][j]=1;
	for(int i=1,x,y;i<=q;i++)
	{
		cin>>x>>y;
		dp[x][y]=dp[y][x]=inv*(dp[x][y]+dp[y][x])%mod;
		for(int j=1;j<=n;j++)
		{
			if(j==x || j==y)	continue;
			dp[x][j]=dp[y][j]=(inv*dp[x][j]+inv*dp[y][j])%mod;
			dp[j][x]=dp[j][y]=(inv*dp[j][x]+inv*dp[j][y])%mod;
		}
	}
	int now=1,ans=0;
	for(int i=1;i<=q;i++)
		(now*=2)%=mod;
	for(int i=1;i<=n;i++)
		for(int j=1;j<i;j++)
			(ans+=dp[i][j])%=mod;
	cout<<ans*now%mod<<endl;
			
	

}

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

int main() {
	// your code goes here
int n;
cin>>n;
//vector<int>A(n);
int ans=0;
for(int i=1;i<=n;i++)
{
    int x;
    cin>>x;
    if(i%2!=0 && x%2!=0){ans++;}
}
cout<<ans;
	return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<time.h>
#include<stdlib.h>
#include<string>
#include<numeric>

using namespace std;

int main(){
    string a, b, u;
    cin >> a; cin >> b;
    int x, y;
    cin >> x; cin >> y;
    cin >> u;
    if(a == u) x--; else y--;
    cout << x << " "<<  y;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.OutputStream;

public class Main{
	public static void main(String[] args)throws IOException{
		Print p = new Print();
		
		for(int i = 1; i <= 9; i++){
			for(int j = 1; j <= 9; j++){
				p.print((i + "x" + j + "=" + (i * j) + "\n").getBytes());
			}
		}
		p.close();
	}
}

class Print{
	private final OutputStream op = System.out;
	
	public void print(byte buffer[])throws IOException{
		op.write(buffer);
		op.flush();
	}
	public void close()throws IOException{
		op.close();
	}
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> list(2*n,0);
    for(int i=0;i<2*n;i++){
        cin >> list[i];
    }
    sort(list.begin(),list.end());
    int ans=0;
    for(int i=0;i<2*n;i+=2){
        ans+=list[i];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import math

a, b , x = map(int, input().split())


if x == a * a * b :
    ans = 0
elif x <= a * a *b / 2 :
    ans = math.degrees(math.atan((b * b) / (2 * x / a)))
else :
    c = ((2 * x) / (a * a)) - b
    ans = math.degrees(math.atan((b - c) / a))

print(ans)

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

const int m=50;

vector<ll> thick(m+1),patty(m+1);

ll dp(int n,ll x){
  if(x==0){if(n==0) return 1; else return 0;}
  if(x==thick[n]-1) return patty[n];
  if(x==(thick[n]-1)/2) return patty[n-1]+1;
  if(x>(thick[n]-1)/2) return patty[n-1]+1+dp(n-1,x-(thick[n]+1)/2);
  else return dp(n-1,x-1);
  cout << "error";
  return -30000000; 
}
  
int main(){
  int n;
  ll x;
  cin >> n >> x;
  x--;
  
  thick[0]=1;
  patty[0]=1;
  rep(i,n){thick[i+1]=2*thick[i]+3;patty[i+1]=2*patty[i]+1;}
  
  cout << dp(n,x);
  return 0;
}

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

#define DEBUG (0)

int main(void)
{
  long double l;
  long double v;
  long double a = 27.0;
  
  cin >> l;
  
#if DEBUG
  cout << "l: " << l << endl; 
#endif
  v = l*l*l/a;
  cout<< setprecision(10) << fixed << v <<endl;  
}


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

using namespace std;

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    cout <<  a[0]  << " " <<  a[1]  <<  " " <<  a[2]  <<endl;
}

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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;
typedef pair<double, double> pd;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

vll seg;
vll lazy;
ll n; // 葉の数

int main() {
    ll i, j, k;
    ll N, K;
    cin >> N >> K;
    vll A(N);
    for(auto &e : A)
        cin >> e;
    for(k = 0; k < K; k++) {
        vll B(N, 0);
        for(i = 0; i < N; i++) {
            ll le = max(0LL, i - A[i]);
            ll ri = min(N, i + A[i] + 1);
            B[le]++;
            if(ri < N) {
                B[ri]--;
            }
        }
        for(i = 1; i < N; i++) {
            B[i] += B[i - 1];
        }
        A = B;
        ll bmin = INF;
        for(i = 0; i < N; i++) {
            bmin = min(bmin, B[i]);
        }
        if(bmin == N) {
            break;
        }
    }
    for(i = 0; i < N; i++) {
        cout << A[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
const ll mod = 1000000007;
const ll inf = 1LL<<60;

int main()
{
  int n,m,p;cin>>n>>m>>p;
  vector<ll> r(p);
  rep(i, p) {
    cin>>r[i];
    r[i]--;
  }
  sort(r.begin(),r.end());
  vector<vector<ll>> d(n, vector<ll>(n, inf));
  rep(i, n) d[i][i] = 0;
  rep(i, m) {
    ll a,b,c; cin>>a>>b>>c; a--; b--;
    d[a][b] = c;
    d[b][a] = c;
  }
  rep(k, n) rep(i, n) rep(j, n) {
    d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
  }
  ll ans = inf;
  do {
    ll tmp = 0;
    for (int i=1; i<p; i++) {
      tmp += d[r[i-1]][r[i]];
    }
    ans = min(ans, tmp);
  } while (next_permutation(r.begin(), r.end()));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a, b, c;
    scanf("%d/%d/%d", &a, &b, &c);
    if(a > 2019) puts("TBD");
    else if(a == 2019){
        if(b >= 5) puts("TBD");
        else puts("Heisei");
    }else puts("Heisei");
    return 0;
}


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

class Dice{
 public:
  int face[7];

  Dice(){
   for(int i = 1; i <= 6; i++)
    cin >> face[i];
  }
 
  void roll_z(){ roll(2,3,5,4);}
  void roll_y(){ roll(1,3,6,4);} // to W
  void roll_x(){ roll(1,2,6,5);} // to N
  void roll(int i, int j, int k, int l){
   int t = face[i]; face[i] = face[j]; face[j] = face[k]; face[k] = face[l]; face[l] = t;
  }

  void Roll(char d){
   if(d == 'E') for(int i = 0; i < 3; i++) roll_y();
   if(d == 'W') roll_y();
   if(d == 'N') roll_x();
   if(d == 'S') for(int i = 0; i < 3; i++) roll_x();
  }
 };

int main(){
 Dice dice;
 string com;

 cin >> com;

 for(int i = 0; i < com.size(); i++)
  dice.Roll(com[i]);

 cout << dice.face[1] << endl;

 return 0;
}

Measured memory_bytes: 1208
const = 10 ** 9 + 7
N = int(input())
TABLE = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]
T = []
ans = 1
for x in TABLE:
    L = []
    for i in range(1,N + 1):
        count = 0
        while i % x == 0:
            i /= x
            count += 1
        L.append(count)
    T.append(sum(L)+1)
#print(T)
for x in T:
    ans *= x
print(ans % const)

Measured memory_bytes: 43756