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

int main() {
  int n;
  cin >> n;
  vector<long long int> a(n);
  long long int z=0;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    z+=a.at(i);
  }
  long long int x=0,y=0;
  for(int i=0;i<n;i++){
    if(2*x<z){
      x+=a.at(i);
    }
  }
  for(int i=n-1;i>=0;i--){
    if(2*y<z){
      y+=a.at(i);
    }
  }
  long long int ans=min(x,y);
  cout << 2*ans-z << endl;
}

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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n,m;
	cin>>n>>m;
	cout<<n+m/2;
	return 0;
}

Measured memory_bytes: 256
using System;

namespace B
{
    class Calc
    {
        public int matricChainOrder(int[] p)
        {
            int n = p.Length-1, i;
            int[,] m = new int[n+1, n+1];
            for (i = 1; i <= n; i++)
            {
                m[i, i] = 0;
            }
            int l, j=0, k, q;
            for (l = 2; l <= n; l++)
            {
                for (i = 1; i <= n - l + 1; i++)
                {
                    j = i + l - 1;
                    m[i, j] = int.MaxValue;
                    for (k = i; k < j; k++)
                    {
                        q = m[i, k] + m[k + 1, j] + p[i - 1] * p[k] * p[j];
                        m[i, j] = min(m[i, j], q);
                    }
                }
            }
            return m[1, n];
        }

        public int min(int m, int q)
        {
            if (m<q)
            {
                return m;
            }
            else
            {
                return q;
            }
        }
    }

    class B
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input), i;
            string[] input2 = new string[2];
            int[] p = new int[n+1];
            Calc calc = new Calc();
            for (i = 0; i < n; i++)
            {
                input2 = Console.ReadLine().Split(' ');
                p[i] = int.Parse(input2[0]);
                p[i+1] = int.Parse(input2[1]);
            }
            Console.WriteLine(calc.matricChainOrder(p));
        }
    }
}



Measured memory_bytes: 15968
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;

int dp[100010];
bool ok[100010];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	VE a(m); rep(i, m)cin >> a[i];
	rep(i, 100010)ok[i] = true;
	rep(i, m)ok[a[i]] = false;
	dp[0] = 1;
	if (ok[1])dp[1] = 1;
	else dp[1] = 0;
	rep(i, n + 1) {
		if (i == 0 || i == 1)continue;
		if (ok[i])dp[i] = (dp[i - 1] + dp[i - 2])%MOD;
		else dp[i] = 0;
	}
	cout << dp[n] %MOD<< endl;
	return 0;
}

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

#define rep(i, n) for ( ll i = 0; i < (n); ++i )
#define reps(i, n) for ( ll i = 1; i <= (n); ++i )
#define _rep(i, n) for ( ll i = (n) - 1; i >= 0; --i )
#define _reps(i, n) for ( ll i = n; i > 0; --i )
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

using namespace std;
using ll =  long long;
using P = pair<ll, ll>;



int main( void )
{
	ll n, k;
	cin >> n >> k;

	ll a[n + 1];
	reps( i, n ) {
		cin >> a[i];
	}

	ll   b[n + 1]   = {};
	bool flg[n + 1] = {};
	b[0]   = 1;
	flg[0] = true;
	ll cnt = 1;
	while ( cnt <= n ) {
		b[cnt]   = a[b[cnt - 1]];
		if ( flg[b[cnt]] ) {
			break;
		}
		flg[b[cnt]] = true;
//		cout << b[cnt] << " ";
		if ( cnt == k ) {
			cout << b[cnt] << endl;
			return 0;
		}
		cnt++;
	}
//	cout << endl;

	ll tmp = 0;
	while ( b[tmp] != b[cnt] ) {
		tmp++;
	}

//	cout << tmp << endl;
//	cout << cnt << endl;
//	cout << ((k - tmp) % (cnt - tmp)) << endl;

	cout << b[tmp + ((k - tmp) % (cnt - tmp))] << endl;


	return 0;
}


Measured memory_bytes: 6956
#include <iostream>
#include <vector>
#include <set>
using namespace std;
const long long mod = (1e9) + 7;

struct UnionFind{
  vector<int> data;
  UnionFind(int n) : data(n, -1) {}
  bool unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x != y){
      if(data[y] < data[x]) swap(x,y);
      data[x] += data[y];//高さを更新
      data[y] = x;//親を更新
    }
    return x != y;
  }
  bool same(int x, int y){ return find(x) == find(y); }
  int find(int x){
    if(data[x] < 0) return x;
    return data[x] = find(data[x]);
  }
};

int main(){
  int N, M;
  while(cin >> N >> M, N){
    UnionFind uf(N);
    for(int i = 0; i < M; ++i){
      int a, b;
      cin >> a >> b;
      --a,--b;
      uf.unite(a,b);
    }
    long long ans = 1;
    set<int> S;
    for(int i = 0; i < N; ++i) S.insert(uf.find(i));
    for(size_t i = 0; i < S.size(); ++i) ans *= 2, ans %= mod;
    ans += (N != (int)S.size());
    ans %= mod;
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 7848
#include <iostream>
using namespace std;
#include <queue>
int main(void){
    // Your code here!
    int N;
    cin>>N;
    int a[N];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    int max=0;
    int sum=0;
    for(int i=0;i<N;i++){
        if(a[i]>max)
            max=a[i];
        sum+=a[i];}
    if(sum>max*2){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;

const int N=100005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
inline void read(int &x){
	x=0;char ch=getchar(),rev=0;
	while(ch>'9'||ch<'0') rev=(ch=='-'),ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	x=rev?-x:x;
}
inline int exp(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int n,m,pw[20],dp[1<<15],cnt[20][1<<15];
bool g[20][20];

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
	pw[0]=1;
	for(int i=1;i<=20;i++) pw[i]=pw[i-1]*2;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;scanf("%d%d",&x,&y);
		x--;y--;
		g[x][y]=1;
	}
	for(int i=0;i<n;i++)
		for(int mask=0;mask<(1<<n);mask++){
			if(mask&(1<<i)) continue;
			for(int j=0;j<n;j++)
				if((mask&(1<<j))&&g[i][j]) cnt[i][mask]++;
		}
	dp[3]=1;
	for(int mask=4;mask<(1<<n);mask++){
		if((mask&1)^(mask>>1&1)) continue;
		int ans=0;
		for(int i=mask-1;i;i=(i-1)&mask){	
			int res=dp[i];
			for(int j=0;j<n;j++){
				if(i&(1<<j)) res=(ll)res*(pw[cnt[j][mask^i]]-1)%mod;
				if((mask^i)&(1<<j)) res=(ll)res*pw[cnt[j][i]]%mod;
			}
			ch(ans,res);
		}
		ch(ans,1);
		dp[mask]=ans;
	}
	printf("%d\n",(exp(2,m)-dp[(1<<n)-1]+mod)%mod);
	return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define fi(i,a,b) for(ll i = a; i < b; i++)
#define fd(i,a,b) for(ll i = a; i >= b; i--)
#define cfi(container,it) for(auto it = container.begin(); it != container.end(); it++)
#define cfd(container,it) for(auto it = container.rbegin(); it != container.rend(); it++)
#define vi vector<int>
#define vll vector<ll>
#define all(v) (v).begin(), (v).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back

using namespace std;
using ll = long long;
const int MOD = (int) 1e9 + 7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int ans = 0, sum = 0;

	string s;
	cin>>s;

	fi(i, 0, 3) {
		s[i] == 'R' ? sum++ : sum = 0;
		ans = max(ans, sum);
	}	

	cout<<ans<<'\n';

	return 0;
}

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

int main(){
  long k, n;
  priority_queue<long> pq;
  cin >> k >> n;
  vector<long> a(n);
  for(long i = 0; i < n; i++)
    cin >> a.at(i);
  for(long i = 0; i < n-1; i++)
    pq.push(a.at(i+1) - a.at(i));
  pq.push((k-a.at(n-1)) + a.at(0));
  cout << k - pq.top() << endl;           
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    if (n==1 && m==1) puts("1");
    else if (n==1) cout << m-2 << endl;
    else if (m==1) cout << n-2 << endl;
    else cout << (n-2)*(m-2) << endl;
    return 0;
}

Measured memory_bytes: 256
x,n=map(int,input().split())
P=list(map(int,input().split()))
if x not in P:
    print(x)
else:
    i=0
    while True:
        i+=1
        if x-i not in P:
            print(x-i)
            break
        if x+i not in P:
            print(x+i)
            break

Measured memory_bytes: 9184
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.bmi", "r", stdin);
	string str = "";
	while (getline (cin, str ) ){
		if (str.empty() ){
			break;
		} // end if
		while (str.find(',') != string::npos ){
			str = str.replace(str.find(','), 1, " ");
		} // end while
		int index;
		double hight, wight, bmi;
		stringstream ss(str);
		ss >> index >> wight >> hight;
//		cout << "index: " << index << " hight: " << hight << " wight: " << wight;
//		bmi = (double)wight/((double)hight*(double)hight);
//		cout << " bmi: " << bmi << endl;
		if ((double)wight >= 25.0*(double)hight*(double)hight){
			cout << index << endl;
		} // end if
	} // end loop

	return 0;
}

Measured memory_bytes: 0
fun main(arg: Array<String>) {
    val (H, W, N) = listOfInt()
    val M = java.util.HashMap<Pair<Int, Int>, Int>()
    repeat(N) {
        val (a, b) = listOfInt(-1)
        for (h in -1 .. 1) for (w in -1 .. 1) {
            val key = a + h to b + w
            if ((key.first in 1 until H - 1) && (key.second in 1 until W - 1))
                M.set(a + h to b + w, M.getOrElse(a + h to b + w, { 0 }) + 1)
        }
    }
    val ans = LongArray(10)
    for (m in M) ans[m.value] = ans[m.value] + 1
    ans[0] = (1L * (H - 2) * (W - 2)) - ans.sum()
    ans.forEach { println(it) }
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }




Measured memory_bytes: 202888
#!/usr/bin/env python3
import sys


def solve(X: int):
    for i in range(1000):
        if i*100 <= X <= i*105:
            print(1)
            return 
    
    print(0)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a,b,n; cin >> a >> b >> n;
    n=min(n,b-1);
    cout << -a*(n/b)+(n*a)/b << endl;
}

Measured memory_bytes: 3612
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 256
a,b,c,x,y = map(int,input().split())
cur = a*x+b*y
z = 0
while True:
  x,y,z = x-1,y-1,z+2
  if a*max(0,x)+b*max(0,y)+c*z <= cur:
    cur = a*max(0,x)+b*max(0,y)+c*z
  else:
    print(cur)
    exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()

int main(){
  ll N,ans=0;
  string S;
  cin >> N >> S;
  vector<vector<ll>> Z(S.size(),vector<ll>(S.size()));
  rep(l,S.size()){
    Z.at(l).at(l)= S.size()-l;
    ll i=1,j=0;
    while(i<S.size()-l){
      while(i+j<S.size()-l&&S.at(l+j)==S.at(l+i+j)) j++;
      Z.at(l).at(l+i)=j;
      if(j==0){
        i++;
        continue;
      }
      ll k=1;
      while(k<j&&k+Z.at(l).at(l+k)<j){
        Z.at(l).at(l+i+k)=Z.at(l).at(l+k);
        k++;
      }
      i+=k;
      j-=k;
    }
  }
  rep(l,S.size()-1){
    for(ll i=l+1;i<S.size();i++){
      if(Z.at(l).at(i)<=i-l){
        ans=max(ans,Z.at(l).at(i));
      }else{
        ans=max(ans,i-l);
      }
    }
  }
  cout << ans << endl;
      
      
}

Measured memory_bytes: 195840
N, T = map(int, input().split())
t = [int(i) for i in input().split()]

if N == 1:
    print(T)
else:
    ans = 0
    for x, y in zip(t, t[1:]):
        if y-x >= T:
            ans += T
        else:
            ans += y-x
    ans += T
    print(ans)

Measured memory_bytes: 25200
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top,S[1000];

void push(int x){
    S[++top]=x;
}

int pop(){
    top--;
    return S[top+1];
}

int main(){
    int a,b;
    top=0;
    char s[100];

    while(scanf("%s",s)!=EOF){
        if(s[0]=='+'){
            push(pop()+pop());
        }else if(s[0]=='-'){
            b=pop();
            a=pop();
            push(a-b);
        }
        else if(s[0]=='*'){
            push(pop()*pop());
        }
        else{
            push(atoi(s));
        }
    }

    printf("%d\n",pop());

    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  string s, t;
  cin >> s >> t;
  bool flag = 0;
  rep(i, s.size()) {
    if (s.at(i) == t.at(0)) {
      flag = 1;
      rep(j, s.size()) {
        if (i+j < s.size()) {
          if (s.at(i+j) != t.at(j)) flag = 0;
        } else {
          if (s.at(i+j-s.size()) != t.at(j)) flag = 0;
        }
      }
    }
    if (flag) break;
  }
  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

using namespace std;

int main() {
  int n;
  std::cin >> n;
  static std::array<int, 200001> as;

  int64_t x;
  std::cin >> x;

  int64_t y = 0;
  int a;
  for (int i = 1; i < n - 1; i++) {
    std::cin >> a;
    y += a;
    as[i] = a;
  }
  std::cin >> a;
  y += a;

  int64_t ret = abs(x - y);
  for (int i = 1; i < n - 1; i++) {
    int const aa = as[i];
    x += aa;
    y -= aa;
    ret = std::min(abs(x - y), ret);
  }
  std::cout << ret << std::endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define MAX pow(10,18)
typedef long long ll;

int main(){
  
   int N,harf;
   cin >> N;
   harf = N/2;
   int data[N];
   for(int i=0;i<N;i++) cin >> data[i];
   sort(data,data+N);
 
   cout << data[harf] - data[harf-1] << endl;
}

Measured memory_bytes: 4012
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,j;
	cin>>n;
	map<int,int>m;
	for(i=1;i<=n;i++)
	{
		cin>>j;
		m[j]=i;
	}
	int t=0;
	for(i=1;i<=n;i++)
	{
		if(t)cout<<" ";
		cout<<m[i];
		t=1;
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 5504
#include <cstdio>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <utility>
using namespace std;


int main() {
	int N, M;
	scanf("%d %d", &N, &M);
    int maxL = 1, minR = 100000;
    for (int i=0; i < M; i++) {
        int L, R;
        scanf("%d %d", &L, &R);
        maxL = max(maxL, L);
        minR = min(minR, R);
    }
    if (minR < maxL) {
        printf("%d\n", 0);
    } else {
        printf("%d\n", minR - maxL + 1);
    }
	
	return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    const double EPS = 1e-9;
    int N, M; cin >> N >> M;
    ll sum, p;
    sum = M * 1900 + (N-M) * 100;
    p = 1 << M;
    ll ans = sum * p;
    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,m,c;
  scanf("%d%d%d",&n,&m,&c);
  int b[m],a[n][m],i,j,ans,cou=0;
  for(i=0;i<m;i++)scanf("%d",&b[i]);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++)scanf("%d",&a[i][j]);
    }
  for(i=0;i<n;i++){
    ans=0;
    for(j=0;j<m;j++)ans+=a[i][j]*b[j];
    ans+=c;
    (ans>0)?(cou++):(cou+=0);
  }
  printf("%d",cou);
}

Measured memory_bytes: 128
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components

N,M,Q = map(int,readline().split())
ABC = np.array(read().split(),np.int64)

A = ABC[::3]
B = ABC[1::3]
C = ABC[2::3]

zero = (C == 0)
A0 = A[zero]; B0 = B[zero]

graph = csr_matrix((np.ones(len(A0)),(A0,B0)),(N,N))
Ncomp,comp = connected_components(graph)

A1 = A[~zero]; B1 = B[~zero]

if (comp[A1] == comp[B1]).any():
    print('No')
    exit()

lower = N if len(A1) >= 1 else N - 1
upper = Ncomp * (Ncomp-1) // 2 + (N - Ncomp)

if lower <= M <= upper:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 28408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)
using Graph = vector<vector<int>>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int main(){
    int n,x,y;cin>>n>>x>>y;
    x--;y--;
    int dist[n][n];
    rep(i,n) rep(j,n) dist[i][j]=-1;
    rep(i,n){
        queue<int> q;
        dist[i][i]=0;
        q.push(i);
        while(!q.empty()){
            int ni=q.front();q.pop();
            vector<int> niv;
            if(ni==x) niv.push_back(y);
            if(ni==y) niv.push_back(x);
            if(ni>0) niv.push_back(ni-1);
            if(ni<n-1) niv.push_back(ni+1);
            for(auto j:niv){
                if(dist[i][j]==-1){
                    dist[i][j]=dist[i][ni]+1;
                    q.push(j);
                }
            }
        }
    }
    int ans[n+1]={};
    rep(i,n) for(int j=i+1;j<n;j++) ans[dist[i][j]]++;
    for(int i=1;i<n;i++) cout<<ans[i]<<"\n";
}



Measured memory_bytes: 16000
import math
a, b, c= map(int, input().split())
s = a * b * math.sin(c/180*math.pi) / 2
l = a + b + math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(c/180*math.pi))
h = 2 * s / a
print('%.8f' %s)
print('%.8f' %l)
print('%.8f' %h)


Measured memory_bytes: 5708
#include<stdio.h>
#include<string.h>
int main ()
{
	char arr[1005];
	scanf("%s",arr);
	bool cek=true;
	int pjg=strlen(arr);
	for(int x=0; x<pjg; x++)
	{
		if(arr[x]!=arr[pjg-x-1])
		{
			cek=false;
			break;
		}
	}
	if(cek)
		printf("Yes\n");
	else
		printf("No\n");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;

int main(){
    ll i,j;
    ll n;
    cin>>n;
    if(n%2==1){
        cout<<n-1+((n-1)*(n-3))/2<<endl;
        for(i=1;i<n;i++){
            cout<<n<<" "<<i<<endl;
            for(j=i+1;j<n;j++){
                if((i+j)!=n){
                    cout<<i<<" "<<j<<endl;
                }
            }
        }
    }
    else {
        cout<<(n-1)*(n-1)/2<<endl;
        for(i=1;i<=n;i++){
            for(j=i+1;j<=n;j++){
                if((i+j)!=n+1) cout<<i<<" "<<j<<endl;
         
            }
        }
    }
    

    
    return 0;
}

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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ld n;
   cin >> n;
  if((ll)n%2 == 1) cout << ((ll)n/2+1)/n << endl;
  else cout << ".5000000"<< endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cctype>
#include <cmath>
using namespace std;
typedef long long ll;

int main( void ) {
    double x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    printf( "%.8lf\n", sqrt( pow(x1 - x2, 2 ) + pow(y1 - y2, 2 ) ) );
    return 0;
}



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

const int N = 10005;
pair <int, int> p[N];
int dp[N];

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, t;
    cin >> n >> t;
    for (int i = 1; i <= n; ++ i) {
    	int x, y;
    	cin >> x >> y;
    	p[i].first = x;
    	p[i].second = y;
    }
    
    sort(p + 1, p + 1 + n);
    
    for (int i = 1; i <= n; ++i) {
    	for (int j = t - 1; j >= 0; --j) {
    		dp[min(j + p[i].first, t + 1)] = max(dp[min(j + p[i].first, t + 1)], dp[j] + p[i].second);
    	}
    }
    int mx = 0;
    for (int i = 1; i <= t + 1; ++ i)
    	mx = max(mx, dp[i]);
    cout << mx;
    
    cout << '\n';
    return 0;
}



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

using namespace std;

int main(void){
	int oni = 100,san = 101,kuk = 102,cake = 103,ame = 104,pas = 105;
	int num = 1000000;
	int x = 1000000;
	cin >> x;
	int ans = 0;
	int k = x / oni;
	if(k*oni <= x && x <=k*pas){
		ans = 1;
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
int n,a[101010][3],dp[101010][3];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<3;j++)
		{
			cin>>a[i][j];
		}
	}
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<3;j++)
		{
			for(int k=0;k<3;k++)
			{
				if(j==k)
				{
					continue;
				}
				dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i][j]);
			}
		}
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main(){
  int f[3]={1,1,1},n;
  scanf("%d",&n);
  while(1<n--){
    f[2]=f[0]+f[1];
    f[0]=f[1];
    f[1]=f[2];
  }
  printf("%d\n",f[2]);
  return 0;
}

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

int main() {
  int x, n;
  scanf("%d %d", &x, &n);
  set<int> p;
  for(int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    p.insert(t);
  }
  int d = 0;
  while(1) {
    if(p.find(x - d) == p.end()) {
      printf("%d\n", x - d);
      return 0;
    }
    if(p.find(x + d) == p.end()) {
      printf("%d\n", x + d);
      return 0;
    }
    d++;
  }
}

Measured memory_bytes: 3792
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<utility>

using namespace std;

#define INF 1 << 29
#define LL long long int

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

    int h,w;
    cin >> h >> w;

    vector<string> vec(h);

    for(int i = 0; i < h; i++){
        cin >> vec[i];
    }

    int count = 0;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(vec[i][j] == '.'){
                count++;
            }
        }
    }

    vector<vector<bool>> close(h,vector<bool>(w,false));
    queue<pair<int,int>> open;
    vector<pair<int,int>> move(4);
    move[0] = make_pair(0,1);
    move[1] = make_pair(0,-1);
    move[2] = make_pair(1,0);
    move[3] = make_pair(-1,0);

    vector<vector<int>> cost(h,vector<int>(w,-1));

    cost[0][0] = 1;
    open.push(make_pair(0,0));

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(vec[i][j] == '#'){
                close[i][j] = true;
            }
        }
    }

    while(!open.empty()){
        int y,x;

        y = open.front().first;
        x = open.front().second;

        if(close[y][x]){
            open.pop();
            continue;
        }


        for(int i = 0; i < 4; i++){
            int tmpx = x + move[i].second;
            int tmpy = y + move[i].first;

            if( tmpx >= 0 && tmpx < w && tmpy >= 0 && tmpy < h){
                if(!close[tmpy][tmpx]){
                    open.push(make_pair(tmpy,tmpx));
                    if(cost[tmpy][tmpx] < 0){
                        cost[tmpy][tmpx] = cost[y][x] + 1;
                    }
                }
            }
        }
        close[y][x] = true;
        open.pop();
    }

    if(cost[h-1][w-1] < 0){
        cout << -1 << endl;
    }else{
        cout << count - cost[h-1][w-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    public void Proc()
    {
        bool mustRead = true;
        int idx = 1;
        while(mustRead)
        {
            int num = int.Parse(Console.ReadLine());
            if(num == 0)
            {
                mustRead = false;
                break;
            }
            Console.WriteLine("Case " + idx + ": " + num);
            idx++;
        }
    }



    static void Main(string[] args)

    {

        Program prg = new Program();
        prg.Proc();

    }
}

Measured memory_bytes: 9196
#include <stdio.h>
#define nil 1000
void sort(int A[]){
    int i=0;
    while(A[i]!=nil){
        int j=i+1,minx=i;
        while(A[j]!=nil){
            if(A[j]<A[minx]){
                minx=j;
            }
            j++;
        }
        int s;
        s=A[i];
        A[i]=A[minx];
        A[minx]=s;
        i++;
    }
    
}

int main(){
    int n;
    scanf("%d",&n);
    int L[2*n+1];
    int i;
    for(i=0;i<=2*n-1;i++)scanf("%d",&L[i]);
    L[2*n]=nil;
    sort(L);
    int ans=0;
    for(i=0;i<=n-1;i++){
        ans+=L[2*i];
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
// #define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;



void solve(){
	int a,b;
	cin>>a>>b;
	if(b > a) swap(a,b);
	
	long long prod = 1LL * a * b - 1;
	
	int ans = 2*b - 2;
	
	int L = b, U = a - 1;
	
	if(L < U){
		int x;
		while(L <= U){
			int m = (L+U)/2;
			if(1LL*m*m >= prod + 1){
				x = m;
				U = m - 1;
			}
			else{
				L = m + 1;
			}
		}
		
		ans += x - b;
		
		int k = prod / x;
		
		ans += k - b;
		
	}
	cout<<ans<<"\n";
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SIEVE
		sieve();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 3656
#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;
    cin >> n;
    int64_t a[n];
    map<int64_t, int64_t> mp;
    rep(i,n) {
        cin >> a[i];
        mp[a[i]]++;
    }
    int64_t sum_choice = 0;
    for(auto itr = mp.begin(); itr != mp.end(); itr++) {
        sum_choice += itr->second * (itr->second-1) / 2;
    }
    rep(i,n) {
        int64_t c = mp[a[i]];
        // int64_t ans = sum_choice - c*(c-1)/2 + max((c-1)*(c-2)/2, 0l);
        int64_t ans = sum_choice - c + 1;
        cout << ans << endl;
    }
}

Measured memory_bytes: 11008
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

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

    static class FDivisionOrSubtraction {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.readLong();
            // no of divisors of n-1
            // if k(simulate 2 to sqrt n) divisible by n , add +1

            int n1 = (n == 2) ? 0 : 1;

            for (long i = 2L; i <= Math.sqrt(n - 1); i++)
                if ((n - 1) % i == 0) {
                    if (i == Math.sqrt(n - 1))
                        n1++;
                    else
                        n1 += 2;
                }


            int n2 = 1;
            for (long i = 2L; i <= Math.sqrt(n); i++) {
                if (n % i == 0) {
                    long tmp = n;
                    while (tmp % i == 0) {
                        tmp /= i;
                    }
                    if (tmp % i == 1) n2++;
                }
            }

            System.out.println(n1 + n2);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new RuntimeException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



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

int main(){
  vector<int> yama;
  yama={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  int k;
  cin>>k;
  k=k-1;
  
  cout<<yama.at(k)<<endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ll x;
    cin >> x;

    x *= 2;
    ll t = sqrt(x);
    x /= 2;
    while((t+1)*t/2 < x) {
        ++t;
    }
    cout << t << endl;
}

Measured memory_bytes: 256
def main():
    # 下、右、上、左
    dy = [1, 0, -1, 0]
    dx = [0, 1, 0, -1]
    H, W = map(int, input().split())
    s = ["." * (W + 2)]
    s.extend(["." + input() + "." for i in range(H)])
    s.append("." * (W + 2))
    for y in range(1, H + 1):
        for x in range(1, W + 1):
            if s[y][x] == "#" and s[y + dy[0]][x + dx[0]] == "."\
                    and s[y + dy[1]][x + dx[1]] == "."\
                    and s[y + dy[2]][x + dx[2]] == "."\
                    and s[y + dy[3]][x + dx[3]] == ".":
                print("No")
                return
    print("Yes")
    return


main()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll a[300005];
int main()
{
    int n;
    ll ans=0,ans1 = 0,ans2=0,ans3=0,ans4=0,ans5=0,ans6=0,ans7=0,fu = 0,zh = 0,lng = 0,absum = 0,maxnum = 0,maxi = 0;
    scanf("%d",&n);
    for(int i = 0; i < n; i++)
    {
        scanf("%lld",&a[i]);
        a[i] = a[i] - i - 1;
        absum = absum + abs(a[i]);
        if(a[i]>0) zh++;
        else if(a[i]<0) fu++;
        else lng++;
    }
    absum = absum / n;
    sort(a,a+n);
    maxnum = a[0];
    maxi = 1;
    int cnt = 1;
    for(int i = 1; i < n; i++)
    {
        if(a[i] == a[i-1]) cnt++;
        else cnt=1;
        if(cnt > maxi)
        {
            maxi = cnt;
            maxnum = a[i];
        }
    }
    //printf("%d\n",maxnum);
    if(abs(zh-fu)<=lng)
    {
        for(int i = 0; i < n; i++)
            ans = ans +abs(a[i]);
    }
    else if(zh > fu)
    {
        for(int i = 0; i < n; i++)
            ans = ans + abs(a[i]-a[fu+lng]);
    }
    else
    {
        for(int i = 0; i < n; i++)
            ans = ans + abs(a[i] - a[fu-1]);
    }
    int zho = (a[(n-1)/2]+a[n/2])/2;
    for(int i = 0; i < n; i++)
    {
        ans1 = ans1 + abs(a[i]-zho);
        ans2 = ans2 + abs(a[i]-zho-1);
        ans3 = ans3 + abs(a[i]-zho+1);
        ans4 = ans4 + abs(a[i]-absum);
        ans5 = ans5 + abs(a[i]-absum-1);
        ans6 = ans6 + abs(a[i]-absum+1);
        ans7 = ans7 + abs(a[i]-maxnum);
    }
    printf("%lld\n",min(ans,min(ans1,min(ans2,min(ans3,min(ans4,min(ans5,min(ans6,ans7))))))));
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int n,s=0;
    cin>>n;
    int m=n;
    while(n>0)
    {
        s=s+(n%10);
        n=n/10;
    }
    if(m%s==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


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

int main() {
  string s;
  cin >> s;
  const static string name[2] = {"egg","chicken"};
  vector<int> v;
  for(int i = 0; i < s.size(); ) {
    for(int j = 0; j < 2; ++j) {
      if(s[i] == name[j][0]) {
	v.push_back(j);
	i += name[j].size();
	break;
      }
    }
  }

  vector<vector<int> > t;
  for(int i = 1, length = 1, id = 0; i <= v.size(); ++i) {
    if(i == v.size() || v[i-1] == v[i]) {
      vector<int> tmp(3);
      tmp[0] = -length;
      tmp[1] = id++;
      tmp[2] = v[i-1];
      t.push_back(tmp);
      length = 1;
    } else {
      ++length;
    }
  }
  sort(t.begin(), t.end());
  cout << name[t[0][2]] << endl;
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
        int b=sc.nextInt();
        //int c=sc.nextInt();

        System.out.println(a*b/2);
        sc.close();
    }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i > 0; i--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t int64;

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

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 (b < a) { a = b; return 1; } return 0; }

using namespace std;

class D {
	int rows, columns;
	vector<vector<int>> left, right, up, down;
	vector<string> field;
public:
	D()
	{
		cin >> rows >> columns;

		left.resize(rows, vector<int>(columns, 0));
		right.resize(rows, vector<int>(columns, 0));
		up.resize(rows, vector<int>(columns, 0));
		down.resize(rows, vector<int>(columns, 0));

		field.resize(rows);
		REP(y, rows)
			cin >> field[y];
	}

	void set()
	{
		REP(y, rows)
		{
			int count_left{ 0 }, count_right{ 0 };
			REP(i, columns)
			{
				left[y][i] = count_left;
				right[y][columns - i - 1] = count_right;

				if (field[y][i] == '.')
					count_left++;
				else
					count_left = 0;

				if (field[y][columns - i - 1] == '.')
					count_right++;
				else
					count_right = 0;
			}
		}

		REP(x, columns)
		{
			int count_up{ 0 }, count_down{ 0 };
			REP(i, rows)
			{
				up[i][x] = count_up;
				down[rows - i - 1][x] = count_down;

				if (field[i][x] == '.')
					count_up++;
				else
					count_up = 0;

				if (field[rows - i - 1][x] == '.')
					count_down++;
				else
					count_down = 0;
			}
		}

	}

	void solve()
	{
		set();

		int64 ans{ 0 };
		REP(y, rows)
			REP(x, columns)
			if (field[y][x] == '.')
				chmax(ans, (int64)1 + left[y][x] + right[y][x] + up[y][x] + down[y][x]);

		cout << ans << endl;
	}
};


int main()
{
	D solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 67200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace CsProgramSpace
{
    public partial class Pencil
    {

        partial class Program
        {
            static void Main(string[] args)
            {
                List<int> li = new List<int>();
                int n = int.Parse(Console.ReadLine());
                for(int i = 0; i<n;i++)
                {
                    li.Add(int.Parse(Console.ReadLine()));
                }
                n = 0;
                foreach(int i in li)
                {
                    int sq = (int)Math.Round(Math.Sqrt(i));
                    int j;
                    for(j = 2;j<=sq;j++)
                    {
                        if (i % j == 0) break;
                    }
                    if (j == sq + 1) n++;
                }Console.WriteLine(n);
            }
        }
    }
}


Measured memory_bytes: 17896
//ABC100B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include<stdio.h>
#include<climits>
#include<cfloat>
using namespace std;

int main(){
	int d, n;
	cin >> d >> n;
	int ans = n+(n-1)/99;
	for(int i=0;i<d;i++){
		ans *= 100;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
	int a, b, c, d, e, f;
	float x, y;
	while(cin >> a >> b >> c >> d >> e >> f) {
		y = (d * c * 1.0 - f * a * 1.0) / (d * b * 1.0 - a * e * 1.0);
		x = (c * 1.0 - b * y * 1.0) / a * 1.0;
		printf("%.3lf %.3lf\n", x, y);
	}

	return 0;
}

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

#define int long long

int cache[3005][3005];
int data[3005];

int solve(int i, int j, int parity){
    if(i > j){
        return 0;
    }
    int &res = cache[i][j];
    
    if(res != -1){
        return res;
    }
    
    if(!parity){
        res = max(data[i] + solve(i+1, j, parity^1), data[j] + solve(i, j-1, parity^1));
    }
    else{
        res = min(-data[i] + solve(i+1, j, parity^1), -data[j] + solve(i, j-1, parity^1));
    }
    
    return res;
}

signed main(){
    
    memset(cache, -1, sizeof(cache));
    
    int n;
    cin >> n;
    
    for(int i = 1; i <= n; i++){
        cin >> data[i];
    }
    
    cout << solve(1, n, 0) << '\n';
}

Measured memory_bytes: 70912
#include<stdio.h>
int main(){
  int i,j,k=0,n,q,S[100000],T[50000],left=0,right,mid;

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&S[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++)scanf("%d",&T[i]);


  for(i=0;i<q;i++){
    left=0,right=n;
    while(left<right){
      mid=(left+right)/2;
      if(S[mid]==T[i]){
	k++;
	break;
      }
      if(S[mid]>T[i])right=mid;
      else if(S[mid]<T[i])left=mid+1;
    }
  }

  
  printf("%d\n",k);


  return 0;
}

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

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

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

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

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

ll MOD = 998244353;
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, S; cin >> N >> S;
	vll arr (N);
	F0R(i, N) cin >> arr[i];

	ll ans = 0;
	vll total (S+1);
	F0R(i, N) {
		R0F(s, S+1) if (s + arr[i] <= S) {
			total[s+arr[i]] += total[s];
		}
		if (arr[i] <= S) total[arr[i]] += (i + 1);
		F0R(s, S+1) total[s] %= MOD;
		ans = (ans + total[S]) % MOD;
	}
	print(ans);
}

Measured memory_bytes: 256