akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N;
    cin >> N;

    for (ll h = 1; h <= 3500; h++) {
        for (ll n = 1; n <= 3500; n++) {
            if (4*h*n - N*n - N*h > 0 && N*h*n % (4*h*n - N*n - N*h) == 0) {
                cout << h << " " << n << " " << N*h*n/(4*h*n-N*n-N*h) << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
/*
        |___Arshit Mangukiya___|
        |___DA-IICT____|
        |___201801173____|
*/
        //__WRITE  YOUR  CODE  HERE___//
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;            
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppl;
typedef vector<pll> vpl;
#define ff first
#define ss second
#define pi acos(-1)
#define mr_ad_0501 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define all(a)      a.begin(),a.end()
#define f(i,a,n) for(ll i=a;i<n;i++)
#define MOD 1000000007
#define MAX 200007
#define LM LLONG_MAX
#define sz size()
#define p(x)        cout<< x << " ";
#define pe(x)       cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
const int N=1e5+5;
        /*  bool fun(pair<int,int>a , pair<int,int>b)
            {
                if(a.ff == b.ff)    return a.ss < b.ss;
                else            return a.ff < b.ff;
            }*/
 /*void bfs(ll x)
 {
    queue<ll> q;
    q.push(x);
    while(!q.empty())
    {
        ll k=q.front();
        q.pop();
        for(auto X:v[k])
        {
            if(!vis[X])
            {
                l[X]=l[k]+1;
                vis[X]=1;
                q.push(X);
            }
        }
    }
 }*/
//ll i,j;
/*void dfs(ll v) {
    visited[v] = true;
    for (auto u : adj[v]) {
        if (!visited[u])
            dfs(u);
    }
}*/

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}
 
ll mod_inverse(ll a)
{
	return mod_pow(a , MOD-2 , MOD);
}

void solve()
{
	ll n,d;
	cin>>n>>d;
	ll c=0;
	ll m=d*d;
	f(i,0,n)
	{
		ll x,y;
		cin>>x>>y;
		ll ans=pow(x, 2) +pow(y, 2);
		if(ans<=m)c++;
          
	}
	cout<<c;
}
    
int32_t main(){
    mr_ad_0501;
    ll t=1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    
}    	

Measured memory_bytes: 3652
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};

#define lim 1000000+5

ll a[lim],cnt[lim];

bool sieve(){
    ll x;
    for(ll i=2;i<=1e6;i++){
        x = 0;
        for(ll j=i;j<=1e6;j+=i){
            if(cnt[j]) x+=cnt[j];
        }
        if(x>1) return 0;
    }
    return 1;
}

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n,g=0;
    sfl(n);
    FOR(i,n){
        sfl(a[i]);
        cnt[a[i]]++;
        g = __gcd(a[i],g);
    }
    if(sieve()){
        printf("pairwise coprime\n");
    }
    else if(g==1){
        printf("setwise coprime\n");
    }
    else{
        printf("not coprime\n");
    }
    return 0;
}


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

#define EB emplace_back
#define int long long
#define F first
#define S second
#define N 100005
#define ALL(x) x.begin(),x.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)


using namespace std;

int32_t main()
{
    IOS;

    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        int n; cin>>n;
        
		cout<<fixed;
		cout<<setprecision(6);
        vector<int> per(n);
        for (int i = 0; i < n; i++)
		{
			per[i] = i;
		}
		
        vector<pair<double,double>> v(n);
        for (int i = 0; i < n; i++)
		{
			cin>>v[i].F>>v[i].S;
		}
		
        double ans = 0;
        int fact = 0;
        do
		{
			fact +=1;
			double cnt = 0.0;
			for (int i = 0; i < n - 1; i++)
			{
				cnt += sqrt((v[per[i]].F - v[per[i+1]].F)*(v[per[i]].F - v[per[i+1]].F) + (v[per[i]].S - v[per[i+1]].S) * (v[per[i]].S - v[per[i+1]].S));
			}
			ans += (cnt);
			
		} while (next_permutation(ALL(per)));
		
		
		cout<<ans/(fact * 1.0);
		cout<<endl;
    }
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < n; i++)
const int mx = 200005;
const int md = 1e9+7;
const int hf = 5e8+4;
int b, w;
ll bl, wh;
ll exp(ll b, ll n){
	ll res = 1;
	for(; n; n/=2,(b*=b)%=md) if(n%2) (res *= b) %= md;
	return res;
}
ll fact[mx] = {1}, invf[mx];
void setcomb(int n){
	for(int i = 1; i <= n; i++) fact[i] = (fact[i-1] * i) % md;
	invf[n] =  exp(fact[n] ,md-2);
	for(int i = n; i > 0; i--) invf[i-1] = (invf[i] * i) % md;
}
inline ll comb(int a, int b){return a >= b ? fact[a] * invf[a-b] % md * invf[b] % md : 0;}
int main(){
	scanf("%d%d", &b, &w);
	setcomb(b+w);
	rep(i,b+w){
		ll m = (1 - bl - wh + md*2) % md;
		printf("%lld\n", (bl + m*hf)%md);
		(bl += comb(i,w-1) * exp(exp(2,i),md-2) % md * hf) %= md;
		(wh += comb(i,b-1) * exp(exp(2,i),md-2) % md * hf) %= md;
	}
}

Measured memory_bytes: 5376
require 'pp'
H, W = gets.split.map &:to_i
S = []
H.times do 
    S << gets.chomp.chars.map { |c| c == ?# ? true : false }
end


def bfs(i, j)
    queue = [[i, j, 0]]
    visited = Array.new(H) { Array.new(W, false) }
    visited[i][j] = true
    steps = 0
    while !queue.empty? do
        x, y, count = queue.shift
        steps = count
        queue += [[[x + 1, H-1].min, y, count + 1], [[x - 1, 0].max, y, count + 1], [x, [y + 1, W-1].min, count + 1], [x, [y - 1, 0].max, count + 1]].reject{|a, b, c| visited[a][b] || S[a][b]}.each{|a, b, c| visited[a][b] = true}
    end
    return steps
end

ans = 0
for i in 0..H-1
    for j in 0..W-1
        next if S[i][j]
        ans = [ans, bfs(i, j)].max 
    end
end

p ans


Measured memory_bytes: 2428
N,W=list(map(int, input().split()))
v=[list(map(int, input().split())) for i in range(N)]
v.sort(key=lambda x: x[1])
q=[[0 for i in range(W+1)] for j in range(N+1)]


for i,x in  enumerate(v):
    for j in range(1,W+1):
        
        if x[1]<=j:
            q[i+1][j]=max([q[i][j],x[0]+q[i][j-x[1]]])
            #print([i,j-x[1]])
        else:
            q[i+1][j]=q[i][j]
        
print(q[N][W])
        



Measured memory_bytes: 24684
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N, M;
    cin >> N;
    map<string, ll> mp1;
    map<string, ll> mp2;
    rep(i, N) {
        string s;
        cin >> s;
        mp1[s]++;
    }
    cin >> M;
    rep(i, M) {
        string s;
        cin >> s;
        mp2[s]++;
    }
    ll _max = 0;
    for(pair<string, ll> p:mp1) {
        _max = max(_max, p.second - mp2[p.first]);
    }
    print(_max);
    return 0;
}


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

int main(){
    int n;
    scanf("%d", &n);
    vector<pair<int, int>> G[100000];
    vector<long long> dis(100000,0);
    for(int i=0;i<n-1;i++){
        int f, g, w;
        scanf("%d %d %d", &f, &g, &w);
        f--;
        g--;
        G[f].push_back({g,w});
        G[g].push_back({f,w});
    }
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        auto node = q.front();
        q.pop();
        for(auto to : G[node]){
            if(dis[to.first] != 0) continue;
            dis[to.first] = dis[node] + to.second;
            q.push(to.first);
        }
    }
    for(int i=0;i<n;i++) cout << dis[i] % 2 << endl;
    return 0;
}

Measured memory_bytes: 7168
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <queue>
using namespace std;
int main()
{
    char a[4];
    char b[4];
    char c[4]={0};//1
    char d[4]={0};//2
    scanf("%s %s",a,b);
    int i;
    for(i=0; i<3; i++)
    {
        c[i]=a[2-i];
        d[i]=b[2-i];
    }
    if(strcmp(c,b)==0&&strcmp(d,a)==0)
    {
        printf("YES\n");
    }
    if(strcmp(c,b)!=0||strcmp(d,a)!=0)
    {
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int n,i,an[15][15],bn[15][15],a,b,n1,c=2,d=0,j;
  while(1){
  for(i=0;i<15;i++){
    for(j=0;j<15;j++){
      an[i][j]=bn[i][j]=0;
    }
  }
    c=2;
    d=0;
  scanf("%d",&n);
  if(n==0)break;
  an[n/2+1][n/2]=1;
  bn[n/2+1][n/2]=1;
  a=n/2+1;
  b=n/2;
  n1=n-1;
  while(1){
    a++;
    b++;
    if(a>n1)a=0;
    if(b>n1)b=0;
    if(bn[a][b]!=1){
      an[a][b]=c;
      bn[a][b]=1;
      c++;
  }
    else if(bn[a][b]==1){
    a++;
    b--;
    if(a>n1)a=0;
    if(b<0)b=n1;
      an[a][b]=c;
      bn[a][b]=1;
      c++;
  }
    if(c==n*n+1)break;
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%4d",an[i][j]);
    }
    printf("\n");
  }
 }
  return 0;
}

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

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

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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 main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    int k;
    cin >> k;

    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'a') continue;
        if (k >= 'z' - s[i] + 1) {
            k -= 'z' - s[i] + 1;
            s[i] = 'a';
        }
        //cout << s[i] << " " << 'z' - s[i] + 1 << endl;
    }

    if (k) {
        s[s.size() - 1] = 'a' + (s[s.size()-1] - 'a' + k) % 26;
    }

    cout << s << endl;
    return 0;
}



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

int main(){
    int a,b,c,d,e,f,m,n;
    cin >> a >> b >> c >> d >> e >> f;
    
    if(a<b && a<c && a<d) m=b+c+d;
    if(b<a && b<c && b<d) m=a+c+d;
    if(c<a && c<b && c<d) m=a+b+d;
    if(d<a && d<b && d<c) m=a+b+c;
    if(e<f){
        n=f;
    }else{
        n=e;
    }
    cout << m+n << endl;
}


Measured memory_bytes: 3068
import sys
from io import StringIO
import unittest


def resolve():
    # s = input()
    n = int(input())
    # a, b = map(int, input().split())
    # l = [list(map(int, input().split())) for _ in range(n)]

    print(n + n **2 + n **3)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2"""
        output = """14"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10"""
        output = """1110"""
        self.assertIO(input, output)


if __name__ == "__main__":
    #unittest.main()
    resolve()


Measured memory_bytes: 71060
#include<stdio.h>
int w[60], R, n, p, c, tw[60];
int main(){
    int i;
    while(1){
        scanf("%d%d",&n,&R);
        if(!n)break;
        for(i=1;i<=n;i++)w[i]=n-i+1;
        while(R--){
            scanf("%d%d",&p,&c);
            for(i=1;i<=n;i++)tw[i] = w[i];
            for(i=1;i<=c;i++)w[i]=tw[i+c];
            for(i=1;i<=c;i++)w[i]=tw[i+p-1];
            for(i=c+1;i<p+c;i++)w[i]=tw[i-c];
            for(i=p+c;i<=n;i++)w[i]=tw[i];
        }
        printf("%d\n",w[1]);
    }
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    string s;
    cin >> s;
    int n=s.length();
    int ans=n/2;
    rep(i,n){
        if(s[i]=='p')ans--;
    }
    cout << ans;


}

/*



 */


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){


  int N; cin>>N;
  vector<int> a;
  rep(i,N){
    int aa; cin>>aa;
    a.emplace_back(aa);
  }
  SORT(a);
  int amax=a[N-1];
  double amaxd=amax;
  int amedi=0;
  rep(i,N-1){
    if(abs(a[i]-amaxd/2) < abs(a[amedi]-amaxd/2 )) amedi=i;
  }

  cout<< amax <<" "<<a[amedi]<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 892
#include<iostream>
using namespace std;
int main(){
int a,b;
char op;
while(op!='?'){
cin>>a>>op>>b;
if(op=='+')cout<<a+b<<endl;
if(op=='-')cout<<a-b<<endl;
if(op=='*')cout<<a*b<<endl;
if(op=='/')cout<<a/b<<endl;
}
return 0;
}


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

#define pb push_back

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


vi cs;
int ind;
vi sol;

void dfs(const vvi& g, int v, vi& vis) {
    vis[v] = 1;
    for (int w: g[v]) {
        if (!vis[w])
            dfs(g, w, vis);
    }
    sol[v] = cs[ind++];
}

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

    int n;
    cin >> n;
    vvi g(n);
    for (int i=0; i<n-1; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].pb(b);
        g[b].pb(a);
    }
    cs = vi(n);
    for (int& ci: cs)
        cin >> ci;
    sort(cs.begin(), cs.end());
    ind = 0;
    sol = vi(n);
    vi vis(n);
    dfs(g, 0, vis);

    int solsum = 0;
    for (int i=0; i<n-1; ++i)
        solsum += cs[i];
    cout << solsum << "\n";
    for (int i=0; i<n-1; ++i)
        cout << sol[i] << " ";
    cout << sol[n-1] << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string.h>
#include <iomanip>
using namespace std;

int N,M,s,t,Q;
vector<vector<int>> v(110),rv(110),nv(110);
vector<int> rs;
int visited[110] = {},cmp[110] = {},in_cnt[110] = {};
double p[110] = {},p_cmp[110] = {},dp[110] = {};

void dfs(int n){
    visited[n] = 1;
    for(auto x:v[n]) if(!visited[x]) dfs(x);
    rs.push_back(n);
}

void rdfs(int n,int cnt){
    visited[n] = 1;
    cmp[n] = cnt;
    for(auto x:rv[n]) if(!visited[x]) rdfs(x,cnt);
}

int scc(){
    memset(visited,0,sizeof(visited));
    for(int i=1;i<=N;i++) if(!visited[i]) dfs(i);
    memset(visited,0,sizeof(visited));
    int now = 1;
    for(int i=rs.size()-1;i>=0;i--) if(!visited[rs[i]]) rdfs(rs[i],now++);
    for(int i=1;i<=N;i++){
        for(auto x:v[i]){
            if(cmp[i]!=cmp[x]){
                nv[cmp[i]].push_back(cmp[x]);
                in_cnt[cmp[x]]++;
            }
        }
    }
    return now-1;
}

int main(){
    while(cin >> N && N>0){
        for(int i=1;i<=N;i++){v[i].clear(); rv[i].clear(); nv[i].clear();}
        rs.clear();
        for(int i=1;i<=N;i++){
            p_cmp[i] = 1;
            dp[i] = 1;
            visited[i] = 0;
            cmp[i] = 0;
            in_cnt[i] = 0;
        }
        int m,a;
        for(int i=1;i<=N;i++){
            cin >> p[i] >> m;
            p[i] = 1-p[i];
            for(int j=0;j<m;j++){
                cin >> a;
                v[i].push_back(a);
                rv[a].push_back(i);
            }
        }
        int cmp_size = scc();
        for(int i=1;i<=N;i++){
            p_cmp[cmp[i]] *= 1-p[i];
        }
        double ans = 1;
        for(int i=1;i<=cmp_size;i++){
            p_cmp[i] = 1-p_cmp[i];
            if(in_cnt[i]==0) ans *= p_cmp[i];
        }
        cout << fixed;
        cout << setprecision(10) << ans << endl;
    }
}


Measured memory_bytes: 3352
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n;
        int i;
        int[] score;
        double m;
        double a;

        while(true){
            n = sc.nextInt();
            int sum = 0;
            double asum = 0.0;

            if(n==0){
                break;
            }

            else{
                score = new int[n];

                for(i=0;i<n;i++){
                    score[i] = sc.nextInt();
                    sum += score[i];
                }

                m = (double) sum / n;

                for(i=0;i<n;i++){
                    asum += (score[i] - m ) * (score[i] - m );
                }

                a = asum / n;
                System.out.printf("%.8f\n",Math.sqrt(a));
            }

        }

        sc.close();

    }

}


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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end()))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int a[330], cnt[4];
double dp[330][330][330];
signed main() {
    cin >> N;
    rep(i, N) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    rep(k, N + 1) {
        rep(j, N + 1) {
            rep(i, N + 1) {
                if (i == 0 && j == 0 && k == 0) { continue; }
                if (i > 0) { dp[i][j][k] += i * dp[i - 1][j][k] / (i + j + k); }
                if (j > 0) { dp[i][j][k] += j * dp[i + 1][j - 1][k] / (i + j + k); }
                if (k > 0) { dp[i][j][k] += k * dp[i][j + 1][k - 1] / (i + j + k); }
                dp[i][j][k] += (double) N / (i + j + k);
            }
        }
    }
    cout << dp[cnt[1]][cnt[2]][cnt[3]] << endl;

}


Measured memory_bytes: 238464
//
//  main.cpp
//  ABC175B2
// シンプルな解答
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main(int argc, const char * argv[]) {
    int n;
    cin>>n;
    vector<int>l(n);
    rep(i,n) cin>>l.at(i);
    long long ans=0;
    vector<int>triangle(3);
    rep(i,n){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(l.at(i)==l.at(j))continue;
                if(l.at(i)==l.at(k))continue;
                if(l.at(j)==l.at(k))continue;
                triangle.at(0)=l.at(i);
                triangle.at(1)=l.at(j);
                triangle.at(2)=l.at(k);
                sort(triangle.rbegin(),triangle.rend());
                if(triangle.at(0)>=triangle.at(1)+triangle.at(2)) continue;
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MOD = 1e9 + 7;
using namespace std;

typedef struct cake
{
    ll a;
    ll b;
    ll c;
}cake;

int main()
{
    IOS
    int n,m;
    cin >> n >> m;
    //cout << n << ' ' << m<< '\n';
    cake v[n+1];
    ll ans = 0;
    for(int i=1;i<=n;i++)
    {
        cin >> v[i].a >> v[i].b >> v[i].c;
    }
    for(int i = -1;i<=1;i+=2)
    {
        for(int j = -1;j<=1;j+=2)
        {
            for(int k = -1;k<=1;k+=2)
            {
                vector<ll> tp;
                for(int d=1;d <= n;d++)
                {
                    tp.push_back((ll)i*v[d].a + (ll)j*v[d].b + (ll)k * v[d].c);
                }
                sort(tp.rbegin(),tp.rend());
                ll s = 0;
                for(int h=0;h<m;h++)
                {
                    s += tp[h];
                }
                ans = max(s,ans);
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
struct A{int a,b;}a[123];
int pt(A a,A b)
{
	return a.b<b.b;
}
int n;
int ok()
{
	int s=0;
	for(int i=0;i<n;i++)
	{
		s+=a[i].a;
		if(s>a[i].b)return 0;
	}
	return 1;
}
int main()
{
	while(cin>>n&&n)
	{
		for(int i=0;i<n;i++)
			cin>>a[i].a>>a[i].b;
		sort(a,a+n,pt);
		if(ok())puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 1132
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll long long

long long const N = 2e5 + 1, M = 1e9 + 7;
long long fn[N], fd[N], iv[N];

void initnck(){
    iv[1] = fn[1] = fd[1] = iv[0] = fn[0] = fd[0] = 1;
    for (long long i=2; i<N; i++){
        iv[i] = (M - (M/i) * iv[M%i] % M) % M;
        fn[i] = fn[i-1]*i%M;
        fd[i] = fd[i-1]*iv[i]%M;
    }
}

long long nck(long long n, long long k){
    return fn[n] * fd[n-k] % M * fd[k] % M;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    initnck();
 
    ll n,k; cin >> n >> k;
    k = min(n-1, k);
 
    ll ans = 0;
    for (ll x=0; x <= k; x++){
        ans = (ans + nck(n, x) * nck(n-1, x)%M)%M;
    }
    cout << ans << endl;
}

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

int main() {

  int N,K,x;
  int a=0;
  
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    cin >> x;
    if(K-x>x){
    	a+=2*x;
    }else{
    	a+=(K-x)*2;
    }
  }
	cout << a;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

    int ans = 0;
    int count = 0;
    for (int i = 0; i < n - 1; i++)
    {
        if (h[i + 1] <= h[i])
        {
            count++;
            ans = max(ans, count);
        }
        else
        {
            count = 0;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> V;
const long long MOD=1000000007LL;
const long long INFL=1LL << 60;
const int INF=1<<29;


int main() {
    int N,K;
    cin >>N>>K;
    long double fing=0.0;
    while(pow(2,fing)<K){
        fing++;
    }
    long double ans=0.0;
    for(int i=1;i<=N;i++){
        if(pow(2.0,fing-1)*i>=K)fing--;
        if(fing==0){
            ans+=N-i+1;
            break;
        }
        ans+=pow(0.5,fing);
    }
    long double N1=N;
    cout << std::setprecision(13)<<ans/N1<<endl;
    return 0;

}

Measured memory_bytes: 256
import sys
import math
import copy
from typing import Tuple, List, Union
input = sys.stdin.readline

class Process:
    def __init__(self, name: str, value: Union[int, str]):
        self.name = name
        self.value = int(value)
    def takes(self, quontum:int) -> Tuple[int, bool]:
        if self.value > quontum:
            self.value -= quontum
            return (quontum, True)
        else:
            return (self.value, False)

    def __repr__(self):
        return "{}-{}".format(self.name, self.value)


if __name__ == "__main__":
    queue = []
    n, q = map(int , input().split())
    for i in range(n):
        queue.append(Process(*input().split()))
    time = 0
    j = 0
    while len(queue):
        process = queue.pop(0)
        val, rest = process.takes(q)
        time += val
        if rest:
            queue.append(process)
        else:
            print(process.name,time)



Measured memory_bytes: 19068
from collections import deque
N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    a.sort()
    return a

q = deque()
prime = prime_factorize(N)
for x in prime:
  q.append(x)

#print(q)
count = 0
done = []
while N != 1:
  break_flag = False
  if len(q) == 0:
    break
  x = q.popleft()
  #print(N, q, x)
  if x == 1:
    continue
  
  if x in done:
    mul = x
    while mul in done:
      if len(q) == 0:
        break_flag = True
        break
      pop = q.popleft()
      #print(x, pop)
      if x != pop:
        #print(x, pop, q)
        q.appendleft(pop)
        #print(q)
        break_flag = True
        break
      mul *= pop
    x = mul
    if break_flag:
      continue
  
  if N % x == 0:
    N = N // x
    count += 1
    done.append(x)

print(count)
#print(done)

Measured memory_bytes: 9484
a = input().split(" ")
b = int(a[1])
c = int(a[2])
a = int(a[0])
k = int(input())
check=0
while True:
  if check == k:
    if int(c) > int(b) and int(b) > int(a): 
      print("Yes")
      break;
    else:
      print("No")
      break;
  else:
    if int(c) <= int(b):
      c = c*2
      check += 1
    elif int(b) <= int(a):
      b = b*2
      check += 1
    else:
      c = c*2
      check += 1

Measured memory_bytes: 8960
from collections import Counter

def prime_factor(n):
    c = Counter()
    i = 2
    while i * i <= n:
        while (n % i == 0):
            c[i] += 1
            n = n//i
        i += 1
    if n != 1:
        c[n] += 1

    return c

N, P = map(int, input().split(" "))

c = prime_factor(P)
ans = 1
for n, x in c.most_common():
    if x >= N:
        ans *= pow(n, (x//N))
    else:
        break
print(ans)


Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC113_C{
    class Program{
        static void Main(string[] args){
            int[] s = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
            int[][] arr = new int[s[1]][];
            int[] h = new int[s[0] + 1];

            for(var i = 0;i < s[1];i++){
                arr[i] = Array.ConvertAll((Console.ReadLine() + " " + i.ToString()).Split(' '),int.Parse);
            }

            Array.Sort(arr,(u,v) => u[1] - v[1]);
            for(var i = 0;i < s[1];i++){
                h[arr[i][0]]++;
                arr[i][1] = h[arr[i][0]];
            }
            Array.Sort(arr,(u,v) => u[2] - v[2]);

            for(var i = 0;i < s[1];i++){
                Console.WriteLine("{2}{0}{3}{1}",arr[i][0],arr[i][1],new string('0',6 - arr[i][0].ToString().Length),new string('0',6 - arr[i][1].ToString().Length));
            }
        }
    }
}


Measured memory_bytes: 26380
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e5+500;
int tmp[N],w[N],odd[N],p[N],n,m;
int main()
{
    scanf("%d%d",&n,&m);int cnt=0;
    for(int i=1;i<=m;i++)
    {
        scanf("%d",w+i);
        if(w[i]&1)odd[++cnt]=w[i],p[i]=1;
    }
    if(m==1){}
    if(cnt>=3){puts("Impossible");return 0;}
    int tn=0;for(int i=1;i<=m;i++)if(!p[i])tmp[++tn]=w[i];
    if(cnt==1)
    {
        printf("%d ",odd[1]);
        for(int i=1;i<=tn;i++)printf("%d ",tmp[i]);puts("");
        if(m==1)
        {
            if(n==1)printf("%d\n%d",1,1);
            else printf("%d\n%d %d\n",2,odd[1]-1,1);
            return 0;
        }
        printf("%d\n",m);
        printf("%d ",odd[1]+1);
        for(int i=1;i<tn;i++)printf("%d ",tmp[i]);
        if(tn)printf("%d\n",tmp[tn]-1);
        return 0;
    }
    if(!cnt)
    {
        for(int i=1;i<=tn;i++)printf("%d ",tmp[i]);puts("");
        if(m==1){printf("%d\n",2);printf("%d %d\n",1,tmp[1]-1);return 0;}
        printf("%d\n",m);
        printf("%d ",tmp[1]+1);
        for(int i=2;i<tn;i++)printf("%d ",tmp[i]);
        printf("%d\n",tmp[tn]-1);
        return 0;
    }
    printf("%d ",odd[1]);
    for(int i=1;i<=tn;i++)printf("%d ",tmp[i]);
    printf("%d\n",odd[2]);
    if(odd[2]==1)printf("%d\n",m-1);else printf("%d\n",m);
    printf("%d ",odd[1]+1);
    for(int i=1;i<=tn;i++)printf("%d ",tmp[i]);
    if(odd[2]!=1)printf("%d\n",odd[2]-1);
}

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

int a, b, c, d;
int main() {
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0) {
        c -= b;
        if(c <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3632
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)
	if (a < c && c < b) || (b < c && c < a){
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 21:52:40 2020

@author: naoki
"""

N = int(input()) # 並んでいる人数N

S = input() # 向いている方向
    
change = [0 for i in range(N)] # 向きを変えた回数を格納
change[0] = S.count("E",1,N)
for i in range(1,N):
        if S[i-1] == "W" and S[i] == "E":
            change[i] = change[i-1]
        elif S[i-1] == "W" and S[i] != "E": 
            change[i] = change[i-1] + 1
        elif S[i-1] != "W" and S[i] == "E":
            change[i] = change[i-1] - 1
        else:
            change[i] = change[i-1]
change.sort()
print(change[0])

Measured memory_bytes: 16556
const main = (input) => {
  const strList = input.split('');
  const atcoderStrList = ['A', 'C', 'G', 'T'];
  let matchedNum = 0;
  let maxNum = 0

  strList.forEach(str => {
    if (atcoderStrList.indexOf(str) >= 0) {
      matchedNum += 1;
    } else {
      maxNum = Math.max(maxNum, matchedNum);
      matchedNum = 0;
    }
  });

  console.log(maxNum)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 11468
def gcd(p, q) :
	if p % q == 0 :
		return q
	else :
		return gcd(q,p%q)
if __name__ == '__main__':
	k = int(input())
	a = []
	ans = 0
	for i in range(1,k+1) :
		for j in range(1,k+1) :
			a.append(gcd(i,j))
	for i in range(1,k+1) :
		for j in a :
			ans += gcd(i,j)
	print(ans)

Measured memory_bytes: 9364
n,m=map(int,input().split())

a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
ans='No'
for i in range(n-m+1):
    for j in range(n-m+1):
        flag=True
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l]!=b[k][l]:flag=False
        if flag:
            ans='Yes'
            break
print(ans)

Measured memory_bytes: 3064
import itertools

n = int(input())

a =["3","5","7"]
l = []
for i in range(3,10):
    for j in itertools.product(a,repeat=i):
        l.append(j)

ans = 0
for i in l:
    if int("".join(i)) <= n and i.count("3") >= 1 and i.count("5") >= 1 and i.count("7") >= 1:
        ans += 1

print(ans)

Measured memory_bytes: 12412
package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d", &N)

	A := make([]int, N)
	B := make([]int, N)
	C := make([]int, N-1)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
	}
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &B[i])
	}
	for i := 0; i < N-1; i++ {
		fmt.Scanf("%d", &C[i])
	}

	ans := 0
	prev := -1
	for i := 0; i < N; i++ {
		ans += B[A[i]-1]
		if A[i]-1 == prev {
			ans += C[prev-1]
		}
		prev = A[i]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
def Maximum_Profit():
    n = int(input())
    R=[]
    for i in range(n):
        R.append(int(input()))
    minv = R[0]
    for i in range(1,n):
        if i==1:
            maxv=R[1]-R[0]
        elif maxv<R[i]-minv:
            maxv=R[i]-minv
        if minv>R[i]:
            minv=R[i]
    return maxv

maxv = Maximum_Profit()
print(maxv)


Measured memory_bytes: 13588
//om namah shivaaay//
#include <bits/stdc++.h>
#define Om_namah_Shivaay ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
 #define ll long long
 #define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
 const int N=1e5 +5;
 using namespace std;

 int32_t main()
 {
    Om_namah_Shivaay;
    string s,t;
    cin>>s;
    cin>>t;
    isYes(t.substr(0,s.length()) == s);
		 return 0;}
		 


Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(num,init,name) vector<int> name((num),(init));
#define op(i) cout<<(i)<<endl;

int main(){
    int n;
    int tm;
    int a=0;
    cin>>n;
    tm=n;
    while(tm>0){
        a+=tm%10;
        tm/=10;
    }
    if(n%a){
        op("No");
    }else op("Yes");
    
    return 0;

}

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

int max(int x, int y)
{
    if (x >= y) return x;
    else return y;
}

int min(int x, int y)
{
    if (x <= y) return x;
    else return y;
}

int main()
{
    float n, t, a, h[1000];
    scanf("%f", &n);
    scanf("%f%f", &t, &a);
    int i;
    for (i=0; i<n; i++)
    {
        scanf("%f", &h[i]);
    }
    float dt = 10000;
    int ans = 0;
    for (i=0; i<n; i++)
    {
        if (t - h[i]*0.006 >= a) {
            if (t - h[i]*0.006 - a < dt) {
                dt = t - h[i]*0.006 - a;
                ans = i+1;
            }
        } else {
            if (a - (t - h[i]*0.006) < dt) {
                dt = a - (t - h[i]*0.006);
                ans = i+1;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
/*In the name of Allah*/
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000111
#define MAX 100005
#define mod 1000000007
#define ll long long
string a[MAX];
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	ll ans = 0;
	for(int i = 0; i < n; i++)cin>>a[i],sort(a[i].begin(), a[i].end());
	sort(a,a+n);
	ll cnt = 1;
	for(int i = 1 ; i <n ; i++){
		if(a[i] == a[i-1])cnt++;
		else {
			ans += 1LL * (cnt) * (cnt - 1) / 2;
			cnt = 1;
		}
	}
	if(cnt)ans += 1LL * (cnt) * (cnt - 1) / 2;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 5760
def smaller(x, y):
	if x < y:
		return x
	return y

lst = []
for i in range(0, 5):
	lst.append(int(input()))
min = 5000000000000000
for i in range(0, 5):
	first = lst[i]
	lst1 = lst[:i]
	if i != 4:
		lst1 = lst1 + lst[i+1:]
	time1 = first - first % 10
	if first % 10 != 0:
		time1 += 10
	for j in range(0, 4):
		second = lst1[j]
		lst2 = lst1[:j]
		if j != 3:
			lst2 = lst2 + lst1[j+1:]
		time2 = time1 + second - second % 10
		if second % 10 != 0:
			time2 += 10
		for k in range(0, 3):
			third = lst2[k]
			lst3 = lst2[:k]
			if k != 2:
				lst3 = lst3 + lst2[k+1:]
			time3 = time2 + third - third % 10
			if third % 10 != 0:
				time3 += 10
			for p in range(0, 2):
				fourth = lst3[p]
				time4 = time3 + fourth - fourth % 10
				if fourth % 10 != 0:
					time4 += 10
				fifth = lst3[(p+1)%2]
				time5 = time4 + fifth
				min = smaller(min, time5)
print(min)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ff first
#define ss second
signed main()
{
    fast
  char str[99];
  cin>>str;
  int n=strlen(str),f=0,g=0;  
  //cout<<n;
    for(int i=0;i<n;i++)
        {
            if(str[i]!=str[n-i-1])
            {
                f= 1;break;
            }
        }    
        if(f) {cout<<"No"; return 0;}
        else g++;
        int k=(n-3)/2+1;
        for(int i=0;i<k;i++)
        {
            if(str[i]!=str[k-i-1])
            {
                f=1; break;
            }
        }
        if(f) {cout<<"No"; return 0;}
        else g++;
        int j=(n+1)/2;
        for(int i=j;i<n;i++)
        {
            if(str[i]!=str[n-i-1])
            {
                f=1;break;
            }
        }
        //cout<<f;
        if(f) {cout<<"No"; return 0;}
        else g++;
        if(g==3) cout<<"Yes";
} 

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

int main() {
  int n, m, X, Y;
  cin >> n >> m >> X >> Y;
  vector<int> x(n), y(m);
  for (int i = 0; i < n; i++)
    cin >> x[i];
  for (int i = 0; i < m; i++)
    cin >> y[i];

  sort(x.begin(), x.end(), greater<int>());
  sort(y.begin(), y.end(), greater<int>());

  for (int z = x[0] + 1; z <= y[m - 1]; z++) {
    if (z > X && z <= Y) {
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << "War" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007
#define INF 1000000009
typedef long long int lli;

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

  int ans = 1;
  while ( n / 2 != 0 ) {
    ans *= 2;
    n /= 2;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);
const double PI = acos(-1);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H,W;
	cin >> H >> W;
	REP(i,H){
		REP(j,W){
			string s;
			cin >> s;
			if(s == "snuke"){
				int hind = i+1;
				char wind = 'A'+j;
				cout << wind << hind << endl;
				return 0;
			}
		}
	}
	return 0;
}

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

int main(){
	int N, A;
	scanf("%d", &N);
	while(N--){
		scanf("%d", &A);
		if(A % 2 == 0 && (A % 3 != 0 && A % 5 != 0)){
			printf("DENIED\n");
			return 0;
		}
	}
	printf("APPROVED\n");
	return 0;
}

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

int n, m;
vector<double> v[200];
double dp[201];

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++){
		int k;
		scanf("%d", &k);
		v[i].assign(1, 0);
		while (k--){
			int s, h;
			scanf("%d %d", &s, &h);
			for (int j = 0; j < s * h; j++){
				v[i].push_back(1.0 / s);
			}
		}
		for (int j = 0; j + 1 < v[i].size(); j++){
			v[i][j + 1] += v[i][j];
		}
	}
	for (int i = 0; i < n; i++){
		for (int j = m - 1; j >= 0; j--){
			for (int k = 1; j + k <= m; k++){
				if (k >= v[i].size()) break;
				dp[j + k] = max(dp[j + k], dp[j] + v[i][k]);
			}
		}
	}
	
	printf("%.20f\n", dp[m]);
}

Measured memory_bytes: 3588
#include <iostream>

using namespace std;

int count(int i) {
    int a = 0;
    while (i > 0) {
        a++;
        i /= 10;
    }
    return a;
}
int main() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i=1; i<=N; i++) {
        if (count(i) % 2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
 int b[101];
 int num[201][4],n;
 cin>>n;
 for(int i=0;i<n;i++){
  cin>>num[i][1]>>num[i][2]>>num[i][3];
 }
 for(int i=1;i<=3;i++){
  fill(b,b+101,0);
  for(int j=0;j<n;j++){
   b[num[j][i]]++;
  }
  for(int j=0;j<n;j++){
   if(b[num[j][i]]>1) num[j][i]=0;
  }
 }
 for(int i=0;i<n;i++) cout<<num[i][1]+num[i][2]+num[i][3]<<endl;
}

Measured memory_bytes: 1160
import sys
from collections import deque

sys.setrecursionlimit(1000000)
input = lambda: sys.stdin.readline().rstrip()

S = deque(input())
Q = int(input())
rev = False
for _ in range(Q):
    query = input().split()
    if len(query) == 1:
        rev = not rev
    else:
        if (not rev and query[1] == '1') or (rev and query[1] == '2'):
            S.appendleft(query[2])
        else:
            S.append(query[2])

if rev:
    print(''.join(reversed(S)))
else:
    print(''.join(S))





Measured memory_bytes: 74332
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
using namespace std;
typedef long long ll;
int aa; char ch; int F() {
	while (ch = getchar(), ch < 48 || ch>57); aa = ch - 48;
	while (ch = getchar(), ch > 47 && ch < 58)aa = aa * 10 + ch - 48; return aa;
}
int main() {
	int n, k;
	n = F(), k = F();
	ll x[100], y[100];
	ll xb[100], yb[100];//一直在犯傻 从未间断过。。
	for (int i = 0; i < n; i++) {
		scanf("%lld%lld", &x[i], &y[i]);
		xb[i] = x[i], yb[i] = y[i];
	}
	ll area = 9223372036854775807;
	sort(xb, xb + n);
	sort(yb, yb + n);
	for (int xi = 0; xi < n; ++xi) {
		for (int xj = xi + 1; xj < n; ++xj) {
			for (int yi = 0; yi < n; ++yi) {
				for (int yj = yi + 1; yj < n; ++yj) {
					int num = 0;
					ll lx = xb[xi], rx = xb[xj];
					ll by = yb[yi], uy = yb[yj];
					for (int i = 0; i < n; ++i) {
						if (lx <= x[i] && x[i] <= rx && by <= y[i] && y[i] <= uy) {
							num++;
						}
					}
					if (num >= k) area = min(area, 1LL * (rx - lx) * (uy - by));

				}
			}
		}
	}
	cout << area << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int h,w;
vvi a;
vi b;

int main(){
	cin>>h>>w;
	a=vvi(h,vi(w));
	b=vi(w);
	for(int i=0;i<h;i++) for(int j=0;j<w;j++){
		char c;
		cin>>c;
		if(c=='#') a[i][j]++;
	}
	int res=max(h,w);
	for(int i=0;i<h-1;i++){
		stack<pip> st;
		st.push({-1,{-1,-1}});
		for(int j=0;j<w;j++){
			if(j<w-1&&abs(a[i][j]-a[i][j+1])==abs(a[i+1][j]-a[i+1][j+1])&&abs(a[i][j]-a[i+1][j])==abs(a[i][j+1]-a[i+1][j+1])) b[j]++;
			else b[j]=0;
			while(st.top().first>b[j]){
				pip p=st.top();st.pop();
				res=max(res,(j-p.second.first+1)*(p.first+1));
			}
			st.push({b[j],{st.top().second.second+1,j}});
		}
	}
	cout<<res<<endl;
}

Measured memory_bytes: 18048
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int r, g; cin >> r >> g;
  cout << 2 * g - r << '\n';
  return 0;
}

Measured memory_bytes: 256