akhauriyash/Code-Regression huggingface dataset:
#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>;

const int INF = 1001001001;

int main() {
  string s;
  cin>>s;
  string year, month, day;
  year = s.substr(0,4);
  month = s.substr(5,2);
  day = s.substr(8,2);

  ll yearn, monthn, dayn;
  yearn = atoi(year.c_str());
  monthn = atoi(month.c_str());
  dayn = atoi(day.c_str());


  yearn = yearn*10000;
  monthn = monthn * 100;

  ll m = yearn + monthn + dayn;
  if(m <= 20190430) cout<<"Heisei"<<endl;
  else cout<<"TBD"<<endl;
  return 0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    int count = 0;
    for (int j = 1; j <= i; ++j) {
      if (i % j == 0) count++;
    }
    if (count == 8 && i % 2 == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int a,b;
  vector<int> x(5);
  int count=0;
  cin>>a>>b;
  for (int i=a;i<=b;i++){
    x[0]=i%10;
    x[1]=i/10%10;
    x[3]=i/1000%10;
    x[4]=i/10000%10;
      
    if(x[0]==x[4]&&x[1]==x[3]){
      count=count+1;
    }
  }
  cout <<count<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	while(1){
		int n, i, j, count=0;
		long a[100];
	
		scanf(" %d", &n);
		if(n==0) break;
		
		for(i=0; i<n; i++)
			scanf(" %ld", &a[i]);
		
		for(i=n; i>0; i--){
			for(j=0; j<i-1; j++){
				if(a[j] > a[j+1]){
					long tmp = a[j];
					a[j] = a[j+1];
					a[j+1] = tmp;
					++count;
				}
			}
		}
		
		printf("%d\n", count);
	}

	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;
 
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
   		int a = Integer.parseInt(sc.next());
      	int b = Integer.parseInt(sc.next());
      	if(a*b % 2 == 0){
          System.out.println("Even");
        }else{
          System.out.println("Odd");
        }
    }
}

Measured memory_bytes: 22740
using System;
using System.Linq;
public class Program {
  public static void Main() {
    int[] AB = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    for (int i = 1; i <= 3; i++) {
      if (AB[0] * AB[1] * i % 2 == 1) {
        Console.WriteLine("Yes");
        return;
      }
    }
    Console.WriteLine("No");
  }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mset(s,_) memset(s,_,sizeof s)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
//head
int a[10];
void run() {
	int w1=0;
	for(int i=1;i<=5;i++) {
		int x;
		cin>>x;
		if(x==0) w1=i;
	}
	cout<<w1<<'\n';
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(20);
	//int T; cin >> T; while (T--)
	run();
	return 0;
}

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

int main()
{
    char a[2][3];
    for(int i=0;i<2;i++)
    {
    		scanf("%s",a[i]);
	}
	int n=1;
	for(int i=0,j=2;i<=2,j>=0;i++,j--)
	{
	    if(a[0][i] != a[1][j])
        {
            n=0;
            break;
        }
	}
	if(n)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long N = scanner.nextLong();
        long A = scanner.nextLong() - 1;
        long B = scanner.nextLong() - 1;
        long d = Math.abs(A - B);
        if (d % 2 == 0) {
            System.out.println(d / 2);
        } else {
            long e = Math.min(A, N - B - 1);
            System.out.println(e + (d - 1) / 2 + 1);
        }
    }
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
 
#ifdef _WIN32
    #define gx getchar
    #define px putchar
    #define ps putchar(' ')
    #define pn putchar('\n')
    #define DEBUG 1
#else
    #define gx getchar_unlocked
    #define px putchar_unlocked
    #define ps putchar_unlocked(' ')
    #define pn putchar_unlocked('\n')
    #define DEBUG 0
#endif
 
#define rep(i,j,k) for(ll i=0;i<j;i+=k)
//input
void scan(int &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' ) sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * sign;
}
void lscan(ll &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' )
        sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * (ll)(sign);
}
int sscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
int wscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n' && c!=' ')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
 
//output
void print(int n)
{
    if(n<0)
    {
        n=-n;
        px('-');
    }
    int i=10;
    char o[10];
    do{o[--i] = (n%10) + '0'; n/=10;}while(n);
    do{px(o[i]);}while(++i<10);
}
void lprint(ll n)
{
    if(n<0LL)
    {
        n=-n;
        px('-');
    }
    int i=21;
    char o[21];
    do{o[--i] = (n%10LL) + '0'; n/=10LL;}while(n);
    do{px(o[i]);}while(++i<21);
}
void sprint(const char a[])
{
    const char *p=a;
    while(*p)px(*p++);
}
 
 
ll po(ll a, ll b, ll m)
{
	ll x=1,y=a;
	while(b > 0)
	{
		if(b%2 == 1)
		{
			x=(x*y);
			if(x>m) x%=m;
		}
		y = (y*y);
		if(y>m) y%=m;
		b /= 2;
	}
	return x;
}
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main()
{
	ll n,k;
	cin>>n>>k;
	double x = (double)(4*n-k)/2;
	double y = n-x;
	if(x<0||y<0||ceil(x)!=floor(x)||ceil(y)!=floor(y))
		cout<<"No"<<endl;
	else
		cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rall(s) (s).rbegin(),(s).rend()
#define bs(x) (bitset<18>(x)).to_string()
#define sep ios::sync_with_stdio(0),cin.tie(0)
using namespace std;
typedef long long ll;
int main(){
    sep;
    ll x,a,b,c;
    cin>>x;
   return cout<<fixed<<setprecision(12)<<pow(double(x)/3,3),0;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=9;i++)
    {
        for(int j=i;j<=9;j++)
        {
            if(i*j==n)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double x_1 = sc.nextDouble();
        double y_1 = sc.nextDouble();
        double x_2 = sc.nextDouble();
        double y_2 = sc.nextDouble();
        double d = Math.sqrt((x_2-x_1)*(x_2-x_1) + (y_2-y_1)*(y_2-y_1));
        System.out.println(d);
    }
}


Measured memory_bytes: 27988
#include <bits/stdc++.h>
using namespace std;
int main()
{
    // 整数の入力
	int n;
    int w[100];
    int point,rw,lw;
    int min = 1000000;
    cin >> n;

    for(int i=0;i<n;i++){
        cin >> w[i];
    }
    for(int i=1;i<n;i++){
        lw = 0;
        rw = 0;
        point = i;
        for(int j=0;j<n;j++){
            if(j<point){
                lw += w[j];
            }else{
                rw += w[j];
            }
        }
        if(abs(lw-rw)<min){
            min = abs(lw-rw);
        }
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

const ll mod = 1000000007;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    mint comb(ll n, ll r){
        mint num(2);
        mint den(2);

        for(int i = 0; i < r; i++){
            num *= mint(n-i);
            den *= mint(i+1);
        }
        return num / den;
    }

    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

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

    mint ans(2), ca, cb;
    ans = ans.pow(n);
    ca = ca.comb(n,a);
    cb = cb.comb(n,b);
    ans = ans - 1 - ca - cb;
    cout << ans.x << endl;
}


Measured memory_bytes: 892
#define ll long long
#define MOD 1000000007
#define MOD2 998244353
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set2d(array, val, m, n) memset(array, val, sizeof(array[0][0]) * m * n);
#include <bits/stdc++.h>
using namespace std;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x %= p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll po(ll base, ll powerRaised)
{
    if (powerRaised != 0)
        return (base * po(base, powerRaised - 1));
    else
        return 1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5])
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
//		String[] tmpArray = br.readLine().split(" ");
		int n = Integer.parseInt(br.readLine());
//		int b = Integer.parseInt(tmpArray[1]);
//		int c = Integer.parseInt(tmpArray[2]);
//		int y = Integer.parseInt(tmpArray[3]);
//		int r = Integer.parseInt(tmpArray[4]);

		for(int i = 1 ; i <= n; i++){
			int x = i;
			if(x % 3 == 0 ){
				System.out.print(" "+i);
				continue;
			}
			
			while(x > 0){
				if(x % 10 == 3){
					System.out.print(" "+i);
					break;
				}
				x /= 10;
			}
		}
		System.out.println();
//		String[] tmpArray = br.readLine().split(" ");
//		int[] input = new int[n];
//		long sum = 0;
//		for(int i = 0; i < n; i++){
//			input[i] = Integer.parseInt(tmpArray[i]);
//			sum += input[i];
//		}
//		
//		Arrays.sort(input);
//		System.out.printf("%d %d %d\n", input[0], input[input.length - 1], sum);
//		
//		while(true){
//			String[] tmpArray = br.readLine().split(" ");
//			int a = Integer.parseInt(tmpArray[0]);
//			int b = Integer.parseInt(tmpArray[1]);
//			if(a == 0 && b == 0){
//				break;
//			}
//			
//			for(int i = 0; i < a; i++){
//				for(int j = 0; j < b; j++){
//					if((i + j)%2 == 1){
//						System.out.print(".");
//					}
//					else{
//						System.out.print("#");
//					}
//				}
//				System.out.println();
//			}
//			System.out.println();
//		}

		//		int[] array = new int[3];
//		array[0] = a; array[1] = b; array[2] = c;
//
//		Arrays.sort(array);
//		System.out.printf("%d %d %d\n", array[0], array[1], array[2]);
		/*
		if(a < b && b < c){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}*/
	}

}

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



    int m,n;
    string Common(string text1, string text2){
    	string ans= "";
    	m=text1.size();
		n=text2.size();
		
		if(m==0||n==0)
		return ans;
		
       vector<vector<int> > dp(m+1, vector<int>(n+1,0));
     
        for(int i=1; i<=m; i++){
            for(int j=1; j<=n; j++){
                if(text1[i-1]==text2[j-1])
                    dp[i][j]=dp[i-1][j-1]+1;
        		else dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
            }
        }
        int i=m, j=n;
         while(1){
         	 if(dp[i][j]==0)
                break;
            if(dp[i][j-1]==dp[i][j]){
                --j;
                continue;
            }
            else if(dp[i-1][j]==dp[i][j] ){ 
                --i;
                continue;
            }
            ans+=text1[i-1];
            --i;--j;
           
        }
        reverse(ans.begin(),ans.end());
        return ans;
    }
    
int main() {
		string s1,s3;
		cin>>s1>>s3;
		cout<<Common(s1,s3);
}

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

long long MOD = 1e9+7;
int MAX_INT = 1e9;

// 最大公約数
long long gcd(long long a, long long b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
// 最小公倍数
long long lcm(long long a, long long b) {
  return a / gcd(a, b) * b;
}

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

  int N;
  cin >> N;
  string S;
  cin >> S;

  vector<int> W(N, 0), E(N, 0);
  for(int i = 0; i < N - 1; i++) {
    W[i + 1] = W[i] + (S[i] == 'W');
  }
  int ans = W.back();
  for(int i = N - 1; i > 0; i--) {
    E[i - 1] = E[i] + (S[i] == 'E');
    ans = min(ans, W[i - 1] + E[i - 1]);
  }

  cout << ans << endl;

  return 0;
}


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

struct UnionFind {
    vector<int> par;
    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }
    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


int main(){
  int N,M,K;
  cin>>N>>M>>K;

  UnionFind p(N);
  map<pair<int,int>,int> m;
  map<pair<int,int>,int> n;

  for(int i=0;i<M;++i){
    int a,b;
    cin>>a>>b;
    --a,--b;
    p.unite(a,b);
    ++m[make_pair(a,b)];
  }

  for(int i=0;i<K;++i){
    int c,d;
    cin>>c>>d;
    --c,--d;
    ++n[make_pair(c,d)];
  }

  //友達関係でつなげる総数を求める
  vector<int> r(N,0);
  vector<int> s(N,0);
  for(int i=0;i<N;++i){
    r[i]=p.root(i);
  }

  sort(r.begin(),r.end());
  for(int i=0;i<N;++i){
    s[i]=lower_bound(r.begin(),r.end(),p.root(i)+1)-lower_bound(r.begin(),r.end(),p.root(i));
    --s[i];
  }

  //そこから、友人関係かブロック関係の人を抜く。
  //まず友達関係を抜く
  for(auto t:m){
    --s[t.first.first];
    --s[t.first.second];
  }

  //次に同じ根かつブロックを抜く
  for(auto t:n){
    if(p.same(t.first.first,t.first.second)){
      --s[t.first.first];
      --s[t.first.second];
    }
  }

  for(int i=0;i<N;++i) cout<<s[i]<<" ";
  cout<<endl;

}

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

int main() {
  int A, B, C, D;
  
  cin >> A >> B >> C >> D;

  if (A+B > C+D) {
    cout << "Left" << endl;
  }
  else if (A+B == C+D){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
'use strict'

function main(input){
  const lines = input.split('\n');
  const ABCDEF = lines.shift().split(' ').map(x => parseInt(x));
  const A = ABCDEF[0];
  const B = ABCDEF[1];

  const C = ABCDEF[2];
  const D = ABCDEF[3];

  const E = ABCDEF[4];
  const F = ABCDEF[5];

  let water = [];
  let sugers = [];
  for(let i=0;i<=F;i++){
    for(let j=0;j<=F;j++){
      let current_water = 100*(A*i+B*j);
      if(current_water<=F){ water.push(current_water); }

      let current_suger = C*i + D*j;
      if(current_suger<=F){ sugers.push(current_suger); }
    }
  }

  let results = [];
  let limit_density = 100*E/(100+E);

  for(let i=0;i<water.length;i++){
    for(let j=0;j<sugers.length;j++){
      let total = water[i] + sugers[j];
      let melt_suger = 100*sugers[j]/water[i];
      if( (total <= F) && (melt_suger <= E) ){
        results.push([water[i], sugers[j]]);
      }
    }
  }

  let tmp_melt_suger = 0;
  let result = 0;
  for(let i=0;i<results.length;i++){
      let current_suger = (100*results[i][1])/(results[i][0]+results[i][1]);
      if(current_suger > tmp_melt_suger){ 
        tmp_melt_suger = current_suger;
        result = i;
      }
  }

//console.log(result);
  console.log((results[result][0] + results[result][1])+' '+results[result][1]);
}
main( require('fs').readFileSync( '/dev/stdin', 'utf8') );


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 100005;

int n, H;
int a[N];

int main() {

	FAST;

	cin >> H >> n;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
	}

	int sum = 0;
	for (int i = 1; i <= n; i ++) {
		sum += a[i];
	}

	if (sum >= H) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	//変数の宣言
	int n;
	static char s[100010][10];
	int r;
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp,temp1,temp2;
	int max,min;
	int len;
	//データの読み込み
	
	scanf("%d",&n);
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	printf("0\n");
	fflush(stdout);
	scanf("%s",&s[0]);
	s[n][0]=s[0][0];
	if(s[0][0]=='V')return 0;
	
	l=0;
	r=n;
	while(flag==0){
		temp=(l+r)/2;
		printf("%d\n",temp);
		fflush(stdout);
		scanf("%s",&s[temp]);
		if(s[temp][0]=='V')return 0;
		if((temp-l)%2==1){
			if(s[l][0]==s[temp][0]){
				r=temp;
			}else{
				l=temp;
			}
		}else{
			if(s[l][0]==s[temp][0]){
				l=temp;
			}else{
				r=temp;
			}
		}
	}
	
//	printf("計算部分終了\n");
	//出力
	
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}



Measured memory_bytes: 852
#import pysnooper
import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
from itertools import accumulate,combinations#,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

n,x=map(int,input().split())
a=sorted([int(i) for i in input().split()])
ans=0
l=0
while x>0 and l<n:
    x-=a[l]
    if x>=0:
        ans+=1
    l+=1
if x>0:
    ans-=1
print(ans)

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;


int main(){
    int n;
    cin >> n;
    map<string,int> mp;
    rep(i, n){
        string s;
        cin >> s;
        mp[s]++;
    }
    cout << mp.size() << endl;
    return 0;
}

Measured memory_bytes: 19256
using System;
using System.Linq;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
string[] str=Console.ReadLine().Split(' ');
      long A=long.Parse(str[0]);
      long B=long.Parse(str[1]);
      if((A*B%2)==0){
      Console.WriteLine("Even");
      }else{
        Console.WriteLine("Odd");
      }
      
}
  }

}


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

vector<ll> memo(10001,0);


int main(){
    string S;
    cin >> S;
    stack<char> st;
    ll N = S.size();
    rep(i,N){
        if(st.empty()){
            st.push(S[i]);
            continue;
        }
        if(S[i] == 'S'){
            st.push(S[i]);
        }else{
            if(st.top() == 'S'){
                st.pop();
            }else{
                st.push(S[i]);
            }
        }
    }
    if(st.empty()){
        cout << 0 << endl;
    }else{
        cout << st.size() << endl;
    }
}


Measured memory_bytes: 772
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MOD 1000000007
#define MAX 100010
#define aout(a) REP(i,sizeof(a)) cout << a[i] << " "; cout << endl;
#define vout(v) REP(i,v,size()) cout << v[i] << " "; cout << endl;
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main() {
  ll N; cin>>N;
  vector<ll> x(N),y(N);
  ll max_0 = -10000000010;
  ll max_1 = -10000000010;
  ll min_0 = 10000000010;
  ll min_1 = 10000000010;
  REP(i,N){
    cin>>x[i]>>y[i];
    max_0 = max(max_0,x[i]-y[i]);
    max_1 = max(max_1,x[i]+y[i]);
    min_0 = min(min_0,x[i]-y[i]);
    min_1 = min(min_1,x[i]+y[i]);
  }
  ll ans = max(max_0-min_0,max_1-min_1);
  cout << ans;
}

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

int i, n;
int h, m, s;
int osaki[90000];
int ans;
int main (){
        while(cin >> n && n > 0){
                ans = 0;
                for (i = 0; i <= 90000; i++) osaki[i] = 0;
                for (i = 0; i < n; i++){
                        scanf("%02d:%02d:%02d", &h, &m, &s);
                        osaki[3600 * h + 60 * m + s]++;
                        scanf("%02d:%02d:%02d", &h, &m, &s);
                        osaki[3600 * h + 60 * m + s]--;
                }
                ans = osaki[0];
                for (i = 0; i < 24 * 3600; i++){
                        osaki[i + 1] += osaki[i];
                        ans = max(ans, osaki[i + 1]);
                }
                cout << ans << endl;
        }
        return 0;
}



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

#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)





    int main(){
string ss = "ACL";
ll k;
cin>>k;
string hh ="";
for(ll i=0;i<k;i++){
hh+=ss;
}
cout<<hh<<endl;


 

    }


Measured memory_bytes: 3624
n,m = map(int,input().split())
h = list(map(int,input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
    a[i],b[i] = map(int,input().split())
g = [0] * n
for i in range(m):
    if h[a[i]-1] < h[b[i]-1]:
        g[a[i]-1] = 1
    if h[a[i] - 1] > h[b[i] - 1]:
        g[b[i]-1] = 1
    if h[a[i] - 1] == h[b[i] - 1]:
        g[b[i] - 1] = 1
        g[a[i] - 1] = 1
c = 0
for i in range(n):
    if g[i] == 0:
        c += 1

print(c)


Measured memory_bytes: 21856
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

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

	int T, A;
	cin >> T >> A;

	vector<int> H(N);
	rep(i, N) cin >> H[i];

	int minIdx = -1;
	double minDiff = 10000000;

	rep(i, N) {
		double t = T - 0.006 * H[i];
		double diff = abs(A - t);
		if (diff < minDiff) {
			minIdx = i;
			minDiff = diff;
		}
	}

	cout << minIdx + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#n = ip()                              #入力整数1つ
x,y= (int(i) for i in input().split())      #入力整数横2つ
#a,b,k = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意

if (x+1)//2 >= y:j(1)
else:j(0)

Measured memory_bytes: 6040
//h14-2 IOI饅頭
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace boost_multiprecision = boost::multiprecision;
#define LL long long
#define CINT boost_multiprecision::cpp_int
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int M,N;
vector<int> P;
vector<int> Psum;
vector<pair<int,int>> CE;

int dp[500][10005];

int solve(int now, int nokori){
    if(nokori <= 0) return 0;
    if(now == N) return 0;
    if(dp[now][nokori] != INT_MIN) return dp[now][nokori];
    int re = 0;
    if(Psum[M - nokori] - Psum[M - nokori + CE[now].first] > CE[now].second){
        re = max(re, solve(now+1, nokori - CE[now].first) + Psum[M - nokori] - Psum[M - nokori + CE[now].first] - CE[now].second);
    }
    re = max(re, solve(now+1, nokori));
    dp[now][nokori] = re;
    return re;
}

int main(){
    cin >> M >> N;
    for(int i=0; i<M; i++){
        int tmp;
        cin >> tmp;
        P.push_back(tmp);
    }
    sort(P.begin(), P.end());
    Psum.push_back(P[0]);
    for(int i=1; i<M; i++){
        Psum.push_back(Psum.back() + P[i]);
    }
    reverse(Psum.begin(),Psum.end());
    for(int i=0; i<10005; i++) Psum.push_back(0);
    for(int i=0; i<N; i++){
        int c,e;
        cin >> c >> e;
        CE.push_back(make_pair(c,e));
    }

    for(int i=0; i<M+1; i++){
        for(int j=0; j<N; j++){
            dp[j][i] = INT_MIN;
        }
    }

    cout << solve(0,M) << endl;

    return 0;
}


Measured memory_bytes: 22832
#include <iostream>
using namespace std;
int main() {
	int N,tmp,cnt=0;
	int d[110] = { 0 };
	
	 cin>> N;
	for (int i = 0;i < N;i++) {
		cin >> tmp;
		
		d[tmp]++;
	}

	for (int i = 0;i < 110;i++) {
		if (d[i] != 0) {
			cnt++;
		}
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
// # pragma GCC optimize "-O3"
# define int long long
using namespace std;
  
const int N = 1e5 + 7;
const int mod = 1e9 + 7;

int32_t main() {
    speed;
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int mn = min( a, k ), ans = 0;
    k -= mn;
    ans += mn;
    mn = min( b, k );
    k -= mn;
    mn = min( c, k );
    k -= mn;
    ans -= mn;
    cout << ans << '\n';
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
 
using namespace std;
int main(){
    string s;std::cin >> s;
    int n;n=s.size();
    int mi=1000;
    int a[n],b[n-2];
    rep(i,n){a[i]=s.at(i)-48;}
    
    for(int i=0;i<n-2;i++){
        b[i]=100*a[i]+10*a[i+1]+a[i+2];
        mi=min(mi,abs(753-b[i]));
    }
    std::cout << mi << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    for(int &c:a)cin>>c;
    sort(a.begin(),a.end());
    ll cnt=0;
    for(int i = 0 ; i < n ; i++){
        for(int j = i+1 ; j < n ; j++){
            for(int t = j+1 ; t < n ; t++){
                if(a[i]<a[j]+a[t]&&a[j]<a[i]+a[t]&&a[t]<a[j]+a[i])cnt++;
            }
        }
    }
    cout<<fixed<<setprecision(0)<<cnt;

    return 0;
}

Measured memory_bytes: 384
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn abs(a: i64) -> i64 {
    if a < 0 {
        -a
    } else {
        a
    }
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, mut x: i64, mut k: i64, d: i64);
    let x = abs(x);
    let s = x / d;
    if s > k {
        println!("{}", x - d * k);
        return;
    }
    let a = x - s * d;
    let b = a - d;
    if (k - s) % 2 == 1 {
        println!("{}", abs(b));
    } else {
        println!("{}", abs(a));
    }
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
const int mod = 1000000007;
int a[21];
int dp[1<<21], bc[1<<21];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int x;
			scanf("%d", &x);
			a[i] |= x << j;
		}
	}
	for (int i = 1; i < 1 << 21; i++) {
		bc[i] = bc[i&(i-1)] + 1;
	}
	int m = (1 << n) - 1;
	dp[0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 1 << n; j++) {
			if (bc[j] != i) continue;
			int k = (j ^ m) & a[i];
			for (int l = k; l; l &= l - 1) {
				int nl = l & (l - 1), t = nl ^ l;
				dp[j|t] += dp[j];
				if (dp[j|t] >= mod) dp[j|t] -= mod;
			}
		}
	}
	printf("%d\n", dp[m]);
	return 0;
}


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

using namespace std;
#define local
#ifdef local

template<class T>
void _E(T x) { cerr << x; }

void _E(double x) { cerr << fixed << setprecision(6) << x; }

void _E(string s) { cerr << "\"" << s << "\""; }

template<class A, class B>
void _E(pair<A, B> x) {
    cerr << '(';
    _E(x.first);
    cerr << ", ";
    _E(x.second);
    cerr << ")";
}

template<class T>
void _E(vector<T> x) {
    cerr << "[";
    for (auto it = x.begin(); it != x.end(); ++it) {
        if (it != x.begin()) cerr << ", ";
        _E(*it);
    }
    cerr << "]";
}

void ERR() {}

template<class A, class... B>
void ERR(A x, B... y) {
    _E(x);
    cerr << (sizeof...(y) ? ", " : " ");
    ERR(y...);
}

#define debug(x...) do { cerr << "{ "#x" } -> { "; ERR(x); cerr << "}" << endl; } while(false)
#else
#define debug(...) 114514.1919810
#endif
#define _rep(n, a, b) for (ll n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (ll n = (a); n >= (b); --n)
#define _for(n, a, b) for (ll n = (a); n < (b); ++n)
#define _rof(n, a, b) for (ll n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f3f3f
#define ll long long
#define db long double
#define eps 1e-3
#define bin(x) cerr << bitset<10>(x) << endl
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
#define endl "\n"
const ll mod = 1e9 + 7;
const ll maxn = 2e5 + 10;
const db pi = acos(-1.0);

ll qpow(ll a, ll b) {
    ll ret = 1;
    for (; b; a = a * a % mod, b >>= 1) {
        if (b & 1) {
            ret = ret * a % mod;
        }
    }
    return ret;
}

vector<ll> f(maxn), invf(maxn);

ll inv(ll a) {
    return qpow(a, mod - 2);
}

void prework() {
    f[0] = 1;
    _rep(i, 1, maxn - 1) {
        f[i] = f[i - 1] * i % mod;
    }
    invf[maxn - 1] = qpow(f[maxn - 1], mod - 2);
    for (ll i = maxn - 2; i >= 0; i--) {
        invf[i] = invf[i + 1] * (i + 1) % mod;
    }
}

ll C(ll n, ll m) {
    if (n > m || m < 0)return 0;
    if (n == 0 || m == n) return 1;
    ll res = (f[m] * invf[m - n] % mod * invf[n]) % mod;
    return res;
}

vector<ll> a;
ll n;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    ll res = 0;
    for (auto i:s) {
        res += i - '0';
    }
    cout << (res %9 ? "No" :"Yes") << endl;
}

Measured memory_bytes: 6712
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> xs(n),ys(n);
  for(Int i=0;i<n;i++) cin>>xs[i]>>ys[i];

  using D = double;
  D ans=0;
  for(Int i=0;i<n;i++){
    Int gx=xs[i],gy=ys[i];
    for(Int k=0;k<4;k++){
      {
        Int nx=-gy,ny=gx;
        gx=nx;
        gy=ny;
      }

      Int sx=0,sy=0;
      Int px=0,py=0;
      Int qx=0,qy=0;

      auto dot=[&](Int x1,Int y1,Int x2,Int y2){return x1*x2+y1*y2;};
      auto cross=[&](Int x1,Int y1,Int x2,Int y2){return x1*y2-x2*y1;};
      for(Int j=0;j<n;j++){
        Int res=dot(xs[j],ys[j],gx,gy);
        if(res<0) continue;
        if(res>0){
          sx+=xs[j];
          sy+=ys[j];
          continue;
        }
        if(cross(xs[j],ys[j],gx,gy)>0){
          px+=xs[j];
          py+=ys[j];
        }else{
          qx+=xs[j];
          qy+=ys[j];
        }
      }

      for(Int t=0;t<4;t++){
        D bx=sx,by=sy;
        if(t&1) bx+=px,by+=py;
        if(t&2) bx+=qx,by+=qy;
        chmax(ans,bx*bx+by*by);
      }
    }
  }

  cout<<fixed<<setprecision(12)<<sqrt(ans)<<endl;
  return 0;
}


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

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

    for(int i=0;i<s.length();i++){
        if(s[i]!='B') ans+=s[i];
        else if(ans.length()!=0) ans.erase(ans.begin()+ans.length()-1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import math
k=int(input())
cnt=0
if(k%2==0 or k%5==0):
    print(-1)
else:
    x=7
    while(True):
        if(x%k==0):
            break
        else:
            cnt+=1
            x=((x)*10+7)%k
    print(cnt+1)

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

int n, ans;

int F(int a) {
	int res = 0;
	while(a) {
		res += a % 10;
		a /= 10;
	}
	return res;
}

int main() {
	scanf("%d", &n);
	ans = 0x3f3f3f3f;
	for(int i = 1; i <= n / 2; i++) {
		int a = i, b = n - i;
		a = F(a); b = F(b);
		ans = min(ans, a + b);
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 100

int S[MAX];
int top;

int initialize();
int isEmpty();
int isFull();
void push(int);
int pop();
int main(){
  int x,sub;
  char s[1];

  initialize();
  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      push(pop() + pop());
      //printf("%d %d\n",pop(),pop());/*debug*/
    }else if(s[0] == '-'){
      sub = pop();
        push(pop() - sub);
    }else if(s[0] == '*'){
        push(pop() * pop());
    }else{
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",S[top]);
  return 0;
}
int initialize(){
  top = 0;
}
int isEmpty(){
  return top == 0;
}
int isFull(){
  return top >= MAX - 1;
}
void push(x){
  if(isFull());
  top++;
  //printf("push:%d ,%d\n",x,top);/*debug*/
  S[top] = x;
}
int pop(){
  if(isEmpty());
  top--;
  //printf("pop :%d ,%d\n",S[top+1],top+1);/*debug*/
  return S[top+1];
}

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

P = 10**9 + 7


def make_fac_tables_mod_p(n, p):
    fac = [0] * (n + 1)
    fac_inv = [0] * (n + 1)
    mod_inv = [0] * (n + 1)
    fac[0] = fac[1] = 1
    fac_inv[0] = fac_inv[1] = 1
    mod_inv[1] = 1
    for i in range(2, n + 1):
        fac[i] = (fac[i - 1] * i) % p
        mod_inv[i] = p - mod_inv[p % i] * (p // i) % p
        fac_inv[i] = fac_inv[i - 1] * mod_inv[i] % p
    return fac, fac_inv


def nCk_mod_p(fac, fac_inv, n, k, p):
    return ((fac[n] * fac_inv[n - k]) % p) * fac_inv[k] % p


def main():
    N, K = map(int, input().split())

    R = N - K
    fac, fac_inv = make_fac_tables_mod_p(max(R + 1, K - 1), P)
    for i in range(1, K + 1):
        if i > R + 1:
            print(0)
        else:
            a = nCk_mod_p(fac, fac_inv, R + 1, i, P)
            b = nCk_mod_p(fac, fac_inv, K - 1, K - i, P)
            ans = a * b % P
            print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3572
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    vector<int> x(100002);
    for(int i=0; i<n; ++i){
        int a, b;
        cin >> a >> b;
        ++ x[b];
        -- x[a-1];
    }

    int i = 100001;
    int num = 1;
    for(;;){
        num += x[i];
        if(num >= i){
            cout << (i-1) << endl;
            break;
        }
        -- i;
    }

    return 0;
}

Measured memory_bytes: 0
c,i,p,P,f;main(n){float x[100],y[100],d,t,T;for(;scanf("%d",&n)*n;printf("%d\n",c)){for(T=2e3,c=i=n;d=i--;y[i]<T?T=y[p=f=i]:0)scanf("%f,%f",x+i,y+i);do{T=9;for(i=n;i--;)i-p?t=atan2f(y[i]-y[p],x[i]-x[p]),t+=8*atan(t<d),t<T?T=t,P=i:0:0;p=P,d=T,c--;}while(p-f);}}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
int main(void){
    int n,s[1000],i;
    double a,m;
    while(1){
        cin>>n;
        if(!n) 
           break;
        m=a=0;
        for(i=0;i<n;i++){
            cin>>s[i];
            m+=s[i];
        }
        m/=n;
        for(i=0;i<n;i++){
            a+=(s[i]-m)*(s[i]-m);
        }
        a=sqrt(a/n);
        cout<<fixed<<setprecision(6)<<a<<endl;
    }
}



Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

template<typename T,T MOD = 1000000007>
struct Mint{
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }
  
  Mint inv(){return pow(MOD-2);}
  
  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}
  
  Mint operator+(Mint a) const{return Mint(v)+=a;};
  Mint operator-(Mint a) const{return Mint(v)-=a;};
  Mint operator*(Mint a) const{return Mint(v)*=a;};
  Mint operator/(Mint a) const{return Mint(v)/=a;};

  Mint operator-(){return v?MOD-v:v;}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}
  
};

//INSERT ABOVE HERE
const int MAX = 303;
using M = Mint<int>;
M dp[MAX][MAX];
int used[MAX*2];
int side[MAX*2];
signed main(){
  int n;
  cin>>n;
  vector<int> a(n*2);
  for(int i=0;i<n*2;i++) cin>>a[i];
  
  memset(used,0,sizeof(used));
  for(int i=0;i<n*2;i++)
    if(~a[i]) used[a[i]]=1;

  int cnt=0;  
  memset(side,0,sizeof(side));
  for(int i=0;i<n;i++){
    if(a[i*2]<0&&a[i*2+1]<0){
      cnt++;
      continue;
    }
    if(a[i*2]>0&&a[i*2+1]>0) continue;
    if(a[i*2]>0) side[a[i*2]]=1;
    if(a[i*2+1]>0) side[a[i*2+1]]=1;
  }
  
  for(int j=0;j<MAX;j++)
    for(int k=0;k<MAX;k++)
      dp[j][k]=0;

  dp[0][0]=1;
  
  int num=0,laz=0;
  for(int i=n*2;i>=1;i--){
    if(used[i]&&!side[i]) continue;
    
    if(used[i]){
      assert(side[i]);
      for(int j=n;j>=0;j--)
        for(int k=n;k>=0;k--)
          if(j*2+k+1<=laz) dp[j][k+1]+=dp[j][k];
      num++;
      continue;
    }
    
    if(!used[i]){      
      for(int j=n;j>=0;j--){
        for(int k=n;k>=0;k--){         
          if(j*2+k+1<=laz&&j+1<=cnt) dp[j+1][k]+=dp[j][k]*M(cnt-j);
          if(k+1<=num) dp[j][k+1]+=dp[j][k]*M(num-k);          
        }
      }
      laz++;
      continue;
    }
  }
  
  M ans=dp[cnt][num];
  cout<<ans.v<<endl;
  return 0;
}


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

int main(){
    string s;
    cin >> s;
    string th = "2019/04/30";
    if(s <= th){
        cout << "Heisei" << endl;
    }else{
        cout << "TBD" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys,heapq,math
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

s = inn()
q = int(math.sqrt(s))
if s == 10**18:
    print("0 0 0 1000000000 1000000000 0")
elif s < q*(q+1):
    i = s-q*q+1
    print("0 0 1 {} {} {}".format(q+1,q,q+1-i))
else:
    i = s-q*(q+1)
    print("0 0 1 {} {} {}".format(q+1,q+1,q+1-i))


Measured memory_bytes: 38512
#!/usr/bin/env python3
import sys
from collections import defaultdict


def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
    dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

    for i in range(1,N+1):
        for j in range(W+1):
            dp[i][j] = dp[i-1][j]
            if j >= w[i-1]:
                dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]]+v[i-1])
    print(dp[N][W])


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    w = [int()] * (N)  # type: "List[int]" 
    v = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        w[i] = int(next(tokens))
        v[i] = int(next(tokens))
    solve(N, W, w, v)

if __name__ == '__main__':
    main()


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

int main(){
 int N;
 int a[100];
 int b[100];
 cin>>N;
  
 for(int i=0;i<N;i++){
   cin>>a[i]>>b[i];
 }
 
 int res=0;
  
 for(int i=0;i<N-2;i++){
  if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
   res++;
  }
 }
 
 if(res!=0){
  cout<<"Yes"<<endl;
 }
 else if(res==0){
  cout<<"No"<<endl;
 }
}

Measured memory_bytes: 3600
import java.util.*;

public class Main{
    public static int map[][] = new int[5][5];

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

	int n = sc.nextInt();
	for(int p=0 ; p<n ; p++){

	    for(int i=0 ; i<5 ; i++){
		for(int j=0 ; j<5 ; j++){
		    map[i][j]=sc.nextInt();
		}
	    }
	    
	    max=0;
	    for(int i=0 ; i<5 ; i++){
		for(int j=0 ; j<5 ; j++){
		    if(map[i][j]==0) continue;
		    search(i,j);
		   
		}
	    }
	    System.out.println(max);
	}
    }
    
    static void search(int x,int y){
	int f=0,s=0;
	int i=0,j=0,k=0,l=0;
	for(i=x ; i<5 ; i++){
	    for(j=y ; j<5 ; j++){
		f=1;
		for(k=x ; k<=i ; k++){
		    for(l=y ; l<=j ; l++){
			if(map[k][l]==0){
			    f=0;
			    break;
			}
 
		    }
		}
		if(f==1)max=Math.max(max,(k-x)*(l-y));
	    }
	}
    }

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
using namespace std;
int main()
{
	vector<int>k;
	int ans=0;
	int n;
	cin>>n;
	for (int i=0;i<2*n;i++){
		int y;
		cin>>y;
		k.pb(y);
	}
	sort(all(k));
	for (int i=0;i<2*n;i+=2){
		ans+=k[i];
	}
	cout<<ans;
	re 0;
}

Measured memory_bytes: 256
N,X = map(int,input().split())
x = list(map(int,input().split()))
x += [X]
x.sort()
N = N+1
def GCD(x,y):
    c = x%y
    if c == 0:
        return y
    else:
        return GCD(y,c)
    
xdif = [0] * (N-1)
for i in range(1,N):
    xdif[i-1] = x[i]-x[i-1]
    if i == 1: 
        ans = xdif[i-1]
        continue
    ans = GCD(ans,xdif[i-1])
print(ans)




Measured memory_bytes: 14252
def dot(a, b):
    ret = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(n):
            ret[i][j] = sum(a[i][k] * b[k][j] for k in range(n)) % MOD
    return ret


n, k = map(int, input().split())
dp = [list(map(int, input().split())) for _ in range(n)]
ans = [[0] * n for _ in range(n)]
for i in range(n):
    ans[i][i] = 1
MOD = 1000000007
while k:
    k, i = divmod(k, 2)
    if i:
        ans = dot(ans, dp)
    dp = dot(dp, dp)
print(sum(sum(a) % MOD for a in ans) % MOD)


Measured memory_bytes: 73436
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <stack>
#include <sstream>

using namespace std;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define PB push_back


typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;


const ll mod = 1e9+7;
const ll INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}

int main(){
  int n,m;
  cin>>n>>m;
  string s;
  cin>>s;
  
  s[m-1]=char(s[m-1]-'A'+'a');
  

  cout<<s<<endl;
}

Measured memory_bytes: 256