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

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

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

template<typename Monoid,typename F>
struct SegmentTree{
	int sz;
	vector<Monoid> node;
	const F op;//演算
	const Monoid e;//単位元
	SegmentTree(int n,const F op,const Monoid &e):op(op),e(e){
		sz=1;
		while(sz<n) sz*=2;
		node.assign(2*sz,e);
	}
	void build(const vector<Monoid> &v){
		int n=v.size();
		for(int i=0;i<n;i++) node[i+sz-1]=v[i];
		for(int i=sz-2;i>=0;i--) node[i]=op(node[2*i+1],node[2*i+2]);
	}
	void update(int k,const Monoid &x){
		k+=sz-1;
		node[k]=x;
		while(k>0){
			k=(k-1)/2;
			node[k]=op(node[2*k+1],node[2*k+2]);
		}
	}
	Monoid query(int a,int b,int k=0,int l=0,int r=-1){
		if(r<0) r=sz;
		if(r<=a || b<=l) return e;
		if(a<=l && r<=b) return node[k];
		else{
			Monoid vl=query(a,b,2*k+1,l,(l+r)/2);
			Monoid vr=query(a,b,2*k+2,(l+r)/2,r);
			return op(vl,vr);
		}
	}
	Monoid operator[](const int &k)const{
		return node[k+sz-1];
	}
};

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n,t;
	cin>>n>>t;
	vector<ll> a(n);
	rep(i,n){
		cin>>a[i];
	}
	auto op=[](ll a,ll b){return max(a,b);};
	SegmentTree<ll,decltype(op)> seg(n,op,0);
	seg.build(a);
	map<ll,ll> mp;
	rep(i,n){
		ll ma=seg.query(i+1,n);
		if(ma-a[i]>=0){
			mp[ma-a[i]]++;
		}
	}
	auto itr=mp.end();
	itr--;
	cout<<itr->second<<endl;
}

Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
  int n, q; cin >> n >> q;
  string s; cin >> s;

  vector<int> t(n+1, 0);

  bool f = false;
  REP(i, n){
    switch(s[i]){
      case 'A': f = true;
                break;
      case 'C': t[i+1] = f;
                f = false;
                break;
      default: f = false;
    }

    t[i+1] += t[i];
  }

  while(q--){
    int l, r; cin >> l >> r;
    l--; r--;

    int ret = t[r+1] - t[l];
    if(l != 0 && s.substr(l-1, 2) == "AC") ret--;

    cout << ret << endl;
  }

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;


void solve()
{
        set <string> s;
        int n;
        cin>>n;
        loop(i,0,n)
        {
            string x;
            cin>>x;
            s.insert(x);
        }
        cout<<s.size()<<"\n";

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif


    int t = 1;
   // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 19184
#include <iostream>
#include <string>
using namespace std;
int main(){
    string W,T;
    int i,a = 0;
    cin>>W;
    cin>>T;
    while(T!="END_OF_TEXT"){
        for(i = 0 ; i < T.size();i++){
            if('A'<=T[i]&&T[i]<='Z'){
                T[i]+='a'-'A';
            }
        }
        if(W==T){
            a++;
        }
        cin>>T;
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 3172
import itertools
from collections import defaultdict

N, M = map(int, input().split())

S = []
switch_to_light = defaultdict(list)
for i in range(M):
    s = list(map(int, input().split()))[1:]
    for si in s:
        switch_to_light[si].append(i+1)
p = list(map(int, input().split()))

L = [0, 1]
num = N
bit_list = list(itertools.product(L, repeat=num))

ans = 0
for bits in bit_list:
    lights = [0]*(M+1)
    for i, bit in enumerate(bits):
        s = i+1
        if bit == 0:
            continue
        l = switch_to_light[s]
        for li in l:
            lights[li] += 1
    
    lights = list(map(lambda x:x%2, lights))[1:]
    res = True
    for li, pi in zip(lights, p):
        if li != pi:
            res = False
            break
    if res:
        ans += 1

print(ans)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
long long n, k, x, ans, mod=1000000007;
vector<long long> sol; 
vector<long long> poz, neg;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> k;
for (int i=0; i<n; i++){
	cin >> x;
	if (x>0) poz.push_back(x);
	else neg.push_back(-x); 
} //poz.push_back(0); poz.push_back(0); neg.push_back(0); neg.push_back(0); 
sort(poz.begin(), poz.end()); reverse(poz.begin(), poz.end());
sort(neg.begin(), neg.end()); reverse(neg.begin(), neg.end());
if (poz.empty() and k%2){
	reverse(neg.begin(), neg.end());
	for (int i=0; i<k; i++)
		sol.push_back(-neg[i]);
}
else {
	int pozicija_na_poz=0; int pozicija_na_neg=0;
	if (k%2){sol.push_back(poz[0]); pozicija_na_poz++;}
	while (sol.size()!=k){
	//	cout << pozicija_na_poz << " " << pozicija_na_neg << endl;
	//	cout << poz.size() << " " << neg.size() << endl;
	//	cout << (-1LL+(signed)poz.size()) << endl;
	//	cout << poz[pozicija_na_poz] << " " << poz[pozicija_na_poz+1] << "   " << neg[pozicija_na_neg] << " " << neg[pozicija_na_neg+1] << endl;
		if ((poz.size())<=pozicija_na_poz+1 and (neg.size())<=pozicija_na_neg+1){
			if (poz.size()>pozicija_na_poz){
				sol.push_back(poz[pozicija_na_poz]);
				pozicija_na_poz++;
			}
			else {
				sol.push_back(-neg[pozicija_na_neg]);
				pozicija_na_neg++;
			}
		}
		else if ((neg.size())<=pozicija_na_neg+1)
			{sol.push_back(poz[pozicija_na_poz]); sol.push_back(poz[pozicija_na_poz+1]); pozicija_na_poz+=2;}
		else if ((poz.size())<=pozicija_na_poz+1)
			{sol.push_back(neg[pozicija_na_neg]); sol.push_back(neg[pozicija_na_neg+1]); pozicija_na_neg+=2;}
		else if ((poz[pozicija_na_poz]*poz[pozicija_na_poz+1])>(neg[pozicija_na_neg]*neg[pozicija_na_neg+1]))
			{sol.push_back(poz[pozicija_na_poz]); sol.push_back(poz[pozicija_na_poz+1]); pozicija_na_poz+=2;}
		else {sol.push_back(neg[pozicija_na_neg]); sol.push_back(neg[pozicija_na_neg+1]); pozicija_na_neg+=2;}
	}
}
ans=1; 
for (int i=0; i<k; i++)
	ans= (ans*sol[i])%mod;
//for (int i=0; i<k; i++)
//	cout << sol[i] << " ";
if (ans<0) ans+=mod;
cout << ans;
return 0;
}


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

using namespace std;


int main()
{
  int N;
  string S;
  cin >> N;
  cin >> S;

  int now = 0, st = 0;
  for(int i = 0; i < S.size(); i++) {
    int delta = S[i] == '(' ? 1 : -1;
    now += delta;
    st = min(st, now);
  }
  string s = S;
  while(st < 0) s = "(" + s, ++st, ++now;
  while(now < 0) s = "(" + s, ++now;
  while(now > 0) s += ")", now--;
  cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> sunuke;
  for (int i = 0; i < N; i++) {
    sunuke.push_back(0);
  }
  for (int i = 0; i < K; i++) {
    int di;
    cin >> di;
    for (int j = 0; j < di; j++) {
      int index;
      cin >> index;
      sunuke[index-1] = 1;
    }
  }
  int count = 0;
  for (int sunu : sunuke) {
    if (sunu == 0) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3604
#include <iostream>

int w,h;
int c[50][50];

void dfs(int x,int y){
    c[x][y] = 0;
    for(int dx=-1;dx<=1;dx++){
        for(int dy=-1;dy<=1;dy++){
            int nx = x+dx,ny= y+dy;
            if(0<=nx&&nx<h&&0<=ny&&ny<w&&c[nx][ny] == 1){
                dfs(nx,ny);
            }
        }
    }
    return;
}

int main(){
    while(1){
        std::cin >> w >> h;
        if(w==0&&h==0) break;
        for(int j=0;j<h;j++){
            for(int i=0;i<w;i++){
                std::cin >> c[j][i];
            }
        }
        int num = 0;
        for(int i=0;i<w;i++){
            for(int j=0;j<h;j++){
                if(c[j][i] == 1){
                    dfs(j,i);
                    num++;
                }
            }
        }
        std::cout << num << std::endl;
    }
}



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

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int x, a, b;
	
	cin>>x>>a>>b;
	
	if(abs(x-a)< abs(x-b)) cout<<"A"<<endl;
	else cout<<"B"<<endl;
	
	
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

int main() {
    fastio;
    int a, b, m;
    cin >> a >> b >> m;

    int* fri = new int[a];
    int* mic = new int[b];

    for (int i = 0; i < a; ++i) cin >> fri[i];
    for (int i = 0; i < b; ++i) cin >> mic[i];

    int* dis = new int[m];

    for (int i = 0; i < m; ++i) {
        int x, y, c;
        cin >> x >> y >> c;
        dis[i] = fri[x - 1] + mic[y - 1] - c;
    }
    cout << min(*min_element(dis, dis + m), *min_element(fri, fri+a)+*min_element(mic, mic+b));
    return 0;
}   

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int v[n];
  for(int i=0;i<n;i++) cin>>v[i];
  vector<int> a(100001,0);
  vector<int> b(100001,0);
  for(int i=0;i<n;i++){
    if(i%2==0){
      a[v[i]]++;
    }
    else{
      b[v[i]]++;
    }
  }
  vector<int> c=a;
  vector<int> d=b;
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  int x,y;
  for(int i=0;i<100001;i++){
      if(c[i]==a[100000]){
        x=i;
        break;
      }
  }
  for(int i=0;i<100001;i++){
    if(d[i]==b[100000]){
      y=i;
      break;
    }
  }
  if(a[100000]!=a[99999] && b[100000]!=b[99999] && x==y){
    cout<<n-a[100000]-max(a[99999],b[99999])<<endl;
  }
  else cout<<n-a[100000]-b[100000]<<endl;
}

Measured memory_bytes: 2176
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  ll X,Y;
  cin >> X >> Y;

  int cnt = 1;
  while(1){
    if(X*2<=Y){
      X *= 2;
      cnt++;
    }else{
      break;
    }
  }

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


Measured memory_bytes: 256
#include <cstdio>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
long long N,A,B;
long long out = 0;
long long C;
long long h[1000000];
long long x[1000000];
long long tem;


bool q(long long k){

	long long t = 0;
	REP(N){
		t += max(0.0,ceil((double)(h[i]-(k*B))/C ));
	}
	if(t<=k){
		return true;
	}
	else{
		return false;
	}

}


int main(){
	
	cin >> N >> A >> B;
	C = A - B;

		
	REP(N){
		cin >> h[i];
	}

	long long max = 1000000000;//10^9
	long long min = 0;
	long long mid;
	//にぶたん
	while(max-min>1){
		mid = (max + min)/2;
		if(q(mid)){
			max = mid;
		}
		else{
			min = mid;
		}
	}
	
	cout << max << endl;

}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <list>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <fstream>
#include <tuple>

//....................................................................................................................//

using std::cin;
using std::cout;
using std::vector;
using std::list;
using std::unordered_set;
using std::set;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::swap;
using std::stack;
using std::deque;
using std::queue;
using std::ios_base;
using std::ifstream;
using std::ofstream;
using std::string;
using std::tuple;
using std::make_tuple;
using std::get;
using std::upper_bound;
using std::lower_bound;
using std::max_element;
using std::min_element;

//....................................................................................................................//

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long ul;

[[maybe_unused]] const string endl = "\n";
[[maybe_unused]] const string sep = " ";
[[maybe_unused]] const string yes = "YES\n";
[[maybe_unused]] const string no = "NO\n";
[[maybe_unused]] const double pi = acos(-1);

//....................................................................................................................//



int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout.precision(10);
    double r;
    cin >> r;
    cout << 2 * pi * r;

}

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

int main(){
  int N, a, b, sum=0;
  cin >> N;
  a = N; 
  while(a > 0) {
    b = a % 10; //aの第一位を求める
    sum +=b;
    a = (a - b)/10;
  }
  if (N % sum == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstring>
#include <stdlib.h>


using namespace std;


long long int calc(long long int pre, int offset, const char *str) {
	long long int res = 0;
	string tmp = "";
	char* pEnd;

	if (strlen(str) == offset) {
		res = pre + strtoll(str, &pEnd, 10);
	}
	else {
		// +
		for (int i = 0; i < offset; i++) {
			tmp += str[i];
		}
		res += calc(pre + atoi(tmp.c_str()), 1, &str[offset]);

		// no
		res += calc(pre, offset + 1, str);
	}

	return res;
}

int main() {
	string s;
	cin >> s;
	
	cout << calc(0, 1, s.c_str());
		
	return 0;
}

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

int main(){
  ll K,A,B; cin>>K>>A>>B; K++;
  ll ans=K;
  if(B>A&&(K>=A+2)){
    ll tmp=0;
    K-=A+2;
    tmp+=B;
    tmp+=(B-A)*(K/2)+K%2;
    ans=max(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

 

 int main(){
        int F[46];
        int n,i;
        scanf("%d",&n);
        F[0]=F[1]=1;
        for(i=2;i<=n;i++){F[i]=F[i-2]+F[i-1];}
        printf("%d\n",F[n]);
        return 0;
        }


Measured memory_bytes: 1904
/*..............................................*\
Author:Kishor Kumar Paroi
Dept:CSE-1703053
email.kishor.josephite@gmail.com
RUET,BANGLADESH
\*---------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

//const int N=100*1000;
//const int mod=1e9+7;

//# define int min3(int a,int b,int c){return min(a,min(b,c));}
//#define int max3(int a,int b,int c){return max(a,max(b,c));}
//#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
//#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int N,M;
    cin>>N>>M;
    vector<int> v(M+1,0);
   for(int i=0;i<N;i++)
    {
        int K;
        cin>>K;
        for(int j=0;j<K;j++)
        {
            int tmp;
            cin>>tmp;
            v[tmp]++;
            //cout<<v[tmp]<<endl;
        }
    }
    int ans=0;
    for(int i=1;i<=M;i++)
    {
        if(v[i]==N)
            ans++;
    }
    cout<< ans <<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<head;print0(tail...);}
// clang-format on

int main() {
    ll N;
    cin >> N;
    string S;
    getline(cin, S);
    getline(cin, S);

    vector<ll> R;
    vector<ll> G;
    vector<ll> B;
    set<ll> RS;
    set<ll> GS;
    set<ll> BS;
    for (ll i = 0; i < S.length(); i++) {
        char c = S.at(i);
        if (c == 'R') {
            R.push_back(i);
            RS.insert(i);
        } else if (c == 'G') {
            G.push_back(i);
            GS.insert(i);
        } else {
            B.push_back(i);
            BS.insert(i);
        }
    }

    ll total = 0;
    // ll tpre = 0;
    for (ll i = 0; i < S.length(); i++) {
        char ci = S.at(i);
        for (ll j = i + 1; j < S.length(); j++) {
            char cj = S.at(j);
            ll notk = j + j - i;
            if (ci == 'R') {
                if (cj == 'G') {
                    total += B.end() - lower_bound(B.begin(), B.end(), j) - BS.count(notk);
                } else if (cj == 'B') {
                    total += G.end() - lower_bound(G.begin(), G.end(), j) - GS.count(notk);
                }
            } else if (ci == 'G') {
                if (cj == 'R') {
                    total += B.end() - lower_bound(B.begin(), B.end(), j) - BS.count(notk);
                } else if (cj == 'B') {
                    total += R.end() - lower_bound(R.begin(), R.end(), j) - RS.count(notk);
                }
            } else if (ci == 'B') {
                if (cj == 'R') {
                    total += G.end() - lower_bound(G.begin(), G.end(), j) - GS.count(notk);
                } else if (cj == 'G') {
                    total += R.end() - lower_bound(R.begin(), R.end(), j) - RS.count(notk);
                }
            }
            // if (tpre != total) {
            //     print(i, j, total - tpre);
            // }
            // tpre = total;
        }
    }
    print(total);
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
void f(string s1,string s2)
{
    if(s1.length()==0 || s2.length()==0)
    return;

    vector<vector<int>> dp(s1.length()+1,vector<int>(s2.length()+1,0));

    
    int i,j;
    for( i=1;i<=s1.length();i++)
    {
        for(j=1;j<=s2.length();j++)
        {
            ///cout<<s2[i-1]<<" - "<<s1[j-1]<<"  ";
            if(s1[i-1]==s2[j-1])
            {
                dp[i][j]=dp[i-1][j-1]+1;
            }

            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
        //cout<<endl;
    }
    /*for(i=0;i<=s2.length();i++)
    {
        for(j=0;j<=s1.length();j++)
        {
            cout<<dp[i][j]<<"  ";
        }
        cout<<endl;
    }
    */
    i=i-1;
    j=j-1;
    vector<char> v;
    while(i>0 && j>0)
    {
        //cout<<"("<<i<<" , "<<j<<")"<<endl;
        if(s1[i-1]==s2[j-1])
        {
            //cout<<s2[i-1]<<"  ";
            v.push_back(s1[i-1]);
            i--;
            j--;
            //continue;
        }
        else
        {
            if(dp[i-1][j]>dp[i][j-1])
            i--;

            else
            j--;
        }
    }
    for(int x=v.size()-1;x>=0;x--)
    {
        cout<<v[x];
    }
    return;
}
int main() {
	string s1,s2;
    cin>>s1>>s2;
    f(s1,s2);
    return 0;
}

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

int main() {
  int n, x, y;
  cin >> n >> x >> y;

  int l = n - (y - x) + 1;
  int r = y - x + 1;

  int spl = (r - 1) / 2;
  int lpl = r / 2 - 1;
  int la = x - 1;
  int ra = n - y;

  cout << l + r - 2 << endl;

  for (int k = 2; k < n; k++) {
    int score = max(0, l - k)
      + max(0, min({k - 1, spl, la, la + spl + 1 - k}))
      + max(0, min({k - 2, lpl, la, la + lpl + 2 - k}))
      + max(0, min({k - 1, spl, ra, ra + spl + 1 - k}))
      + max(0, min({k - 2, lpl, ra, ra + lpl + 2 - k}));

    if (r == k * 2) {
      score += r / 2;
    } else if (r > k * 2) {
      score += r;
    }

    cout << score << endl;
  }

  return 0;
}


Measured memory_bytes: 256
a, v = gets.split.map(&:to_i)
b, w = gets.split.map(&:to_i)
t = gets.to_i

if a < b
  x = a + v * t
  y = b + t * w
  if x >= y
    puts 'YES'
  else
    puts 'NO'
  end
else
  x = a - v * t
  y = b - t * w
  if x <= y
    puts 'YES'
  else
    puts 'NO'
  end
end

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



string s, t, yes;
int a, b;

unordered_map<string, int> temp;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> s >> t >> a >> b >> yes;

    temp[s]=a;
    temp[t]=b;

    temp[yes]--;

    printf("%d %d\n", temp[s], temp[t]);
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
  int N, Y;
  cin >> N >> Y;
  int N10 = min((int)(Y / 10000), N);
  int N5 = min((int)(Y / 5000), N);
  for (int i = 0; i <= N10; ++i) {
    for (int j = 0; j <= N5; ++j) {
      int t = 10000 * i + 5000 * j;
      if (N - i - j > 0) {
        t += 1000 * (N - i - j);
      }
      if (t == Y && N - i - j >= 0) {
        printf("%d %d %d\n", i, j, N - i - j);
        return 0;
      }
    }
  }
  printf("-1 -1 -1\n");
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define sc   scanf
#define pr   printf
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define ll   long long
#define ld   long double
#define N    100256
#define M    998244353
#define I    1000000000000000000
#define pdd  pair < ld, ld >
#define pll  pair < ll, ll >
#define pii  pair < int, int >
#define sqr( a )           a * a
#define all( c )           c.begin(), c.end()
#define srt( c )           sort( all( c ) )
#define rev( c )           reverse( all( c ) )
#define srtr( c )          sort( c.rbegin(), c.rend() );
using namespace std;

ll n, m, a[ 505 ][ 505 ], ans = M;
bool ok[ 505 ];
void solve()
{
    sc( "%I64d%I64d", &n, &m );
    for( int i = 0; i < n; i ++ )
        for( int j = 0; j <m; j ++ )
        {
            cin >> a[i][j];
            a[i][j] --;
        }

    for( int k = 0; k < m; k ++ )
    {
        ll v[ 505 ];
        memset( v, 0LL, sizeof v );
        for( int i = 0; i < n; i ++ )
            for( int j = 0; j < m; j ++ )
                if( !ok[ a[i][j] ] )
                {
                    v[ a[i][j] ] ++;
                    break;
                }
        ll cnt = 0, t;
        for( int i = 0; i < m; i ++ )
            if( cnt < v[ i ] )
            {
                cnt = v[ i ];
                t = i;
            }
        ans = min( ans, cnt );
        ok[t] = 1;
    }

    pr( "%I64d", ans );
}

int main()
{
    int tt = 1;
    //sc( "%d", &tt );
    for( int i = 1; i <= tt; i ++ )
        solve();
}












Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef std::vector<ll> vi;

int main() {
  long long a , b , c;
  long long x , y ;

  cin >> a >> b >> c ;
  cin >> x >> y ;
  long long bestxy = min(a+b,c*2);
  long long besty = min(b,c*2);
  long long bestx = min(a,c*2);
  long long res = bestxy * min(x,y);
  if ( x > y )
  {
    x-=y;
    y= 0 ;
  }
  else
  {
    y-=x;
    x= 0 ;
  }
  res+= bestx * x + besty * y ;
  cout << res ;

}

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

using namespace std;

#define ll long long int
#define get(a) ll a; cin >> a;
#define show(a) cout << a << endl;
#define full(p) p.begin(), p.end()
#define sz(a) (ll)(a.size())
#define pb push_back

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout<<fixed;
	////////////////////////////////
	get(n);
	get(l);

	std::vector<string> v;

	for (int i = 0; i < n; ++i)
		{
			string s;
			cin >> s;
			v.push_back(s);
		}

	sort(full(v));
	for (int i = 0; i < n; ++i)
	{
		cout << v[i] ;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define endl '\n'
#define ll long long
#define mod 1000000007
#define inf 1000000000000000000
int main()
{
	fastio;
	#ifdef APNA_IO
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n,ans=0;
	cin>>n;
	ll arr[n];
	for(ll &i:arr)
		cin>>i;
	for(ll i=0;i<n;i++)
	{
		if(i%2==0)
			ans+=arr[i];
		else
			ans-=arr[i];
	}
	cout<<ans<<" ";
	for(ll i=0;i<n-1;i++)
	{
		cout<<(2*arr[i]-ans)<<" ";
		ans=(2*arr[i]-ans);
	}
	return 0;
}





Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N; cin >> N; 
	int X[200010], Y[200010]; char U[200010]; 
	for(int i = 0; i < N; i++) cin >> X[i] >> Y[i] >> U[i]; 
	vector<pair<int, char>> H[200010], V[200010], BR[400010], TR[400010], BL[400010], TL[400010]; 
	for(int i = 0; i < N; i++){
		if(U[i] == 'U'){
			V[X[i]].emplace_back(Y[i], 'U'); 
			TR[X[i] + Y[i]].emplace_back(X[i], 'U'); 
			TL[Y[i] - X[i] + 200000].emplace_back(X[i], 'U'); 
		}else if(U[i] == 'D'){
			V[X[i]].emplace_back(Y[i], 'D'); 
			BL[X[i] + Y[i]].emplace_back(X[i], 'D'); 
			BR[Y[i] - X[i] + 200000].emplace_back(X[i], 'D'); 
		}else if(U[i] == 'R'){
			H[Y[i]].emplace_back(X[i], 'R'); 
			TR[X[i] + Y[i]].emplace_back(X[i], 'R'); 
			BR[Y[i] - X[i] + 200000].emplace_back(X[i], 'R'); 
		}else if(U[i] == 'L'){
			H[Y[i]].emplace_back(X[i], 'L'); 
			BL[X[i] + Y[i]].emplace_back(X[i], 'L'); 
			TL[Y[i] - X[i] + 200000].emplace_back(X[i], 'L'); 
		}
	}
	for(int i = 0; i <= 200000; i++){
		sort(H[i].begin(), H[i].end()); 
		sort(V[i].begin(), V[i].end());
	}
	for(int i = 0; i <= 400000; i++){
		sort(BL[i].begin(), BL[i].end()); 
		sort(BR[i].begin(), BR[i].end());
		sort(TL[i].begin(), TL[i].end()); 
		sort(TR[i].begin(), TR[i].end());
	}
	int ans = 1145141919; 
	for(int i = 0; i <= 200000; i++){
		int h = H[i].size(); 
		int v = V[i].size(); 
		for(int j = 0; j < h-1; j++){
			if(H[i].at(j).second == 'R' && H[i].at(j+1).second == 'L'){
				int diff = H[i].at(j+1).first - H[i].at(j).first; 
				ans = min(ans, 5 * diff); 
			}
		}
		for(int j = 0; j < v-1; j++){
			if(V[i].at(j).second == 'U' && V[i].at(j+1).second == 'D'){
				int diff = V[i].at(j+1).first - V[i].at(j).first; 
				ans = min(ans, 5 * diff); 
			}
		}
	}
	for(int i = 0; i <= 400000; i++){
		int bl = BL[i].size(); 
		int br = BR[i].size(); 
		int tl = TL[i].size(); 
		int tr = TR[i].size(); 
		for(int j = 0; j < bl-1; j++){
			if(BL[i].at(j).second == 'D' && BL[i].at(j+1).second == 'L'){
				int diff = BL[i].at(j+1).first - BL[i].at(j).first; 
				ans = min(ans, 10 * diff); 
			}
		}
		for(int j = 0; j < br-1; j++){
			if(BR[i].at(j).second == 'R' && BR[i].at(j+1).second == 'D'){
				int diff = BR[i].at(j+1).first - BR[i].at(j).first; 
				ans = min(ans, 10 * diff); 
			}
		}
		for(int j = 0; j < tl-1; j++){
			if(TL[i].at(j).second == 'U' && TL[i].at(j+1).second == 'L'){
				int diff = TL[i].at(j+1).first - TL[i].at(j).first; 
				ans = min(ans, 10 * diff); 
			}
		}
		for(int j = 0; j < tr-1; j++){
			if(TR[i].at(j).second == 'R' && TR[i].at(j+1).second == 'U'){
				int diff = TR[i].at(j+1).first - TR[i].at(j).first; 
				ans = min(ans, 10 * diff); 
			}
		}
	}
	if(ans == 1145141919) cout << "SAFE" << "\n"; 
	else cout << ans << "\n"; 
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    ll ans = 0;
    ll sum = 0;
    int tmp = 0;
    rep(i, 0, n) {
        if(a[i] % 10 == 0) {
            sum += a[i];
        }
        else {
            ans += a[i];
            tmp = a[i];
        }
    }
    
    if(ans % 10 == 0) {
        if(tmp == 0) ans = 0;
        else ans = ans+sum-tmp;
    }
    else {
        ans += sum;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
a = readlines.map {|line| line.strip.split.map(&:to_i) }

odd_coins = 0

one_path = []
h.times do |i|
  tmp = []
  w.times do |j|
    tmp << [i, j]
  end
  tmp = tmp.reverse if i.odd?
  one_path += tmp
end

results = []
tmp_result = []
from=nil
one_path.each  do |current|
  coin = a[current[0]][current[1]]

  unless from.nil?
    results.push( [from, current] )
    from = current 
  end

  if coin.odd?
    if from
      from = nil
    else
      from = current 
    end
  end

end

#p results
p results.length

results.each do |r|
  puts r.flatten.map {|n| n+1 }.join(' ')
end


Measured memory_bytes: 80504
import java.lang.Math;
import java.util.Scanner;

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

                System.out.println(Integer.parseInt(str) * 2 * Math.PI);
                scan.close();

        }
}


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

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=n-1; i>=0; i-=2){
        cout << a[i] << ' ';
    }
    if(n%2 == 0){
        for(int i = 0; i<n; i+=2){
            cout << a[i] << ' ';
        }
    }
    else {
        for(int i = 1; i<n; i+=2){
            cout << a[i] << ' ';
        }
    }
}


Measured memory_bytes: 2944
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>

using namespace std;
using ll = long long;

int main(){
    char b;
    cin >> b;
    if(b=='A'){
        cout << "T";
    }
    else if(b=='C'){
        cout << "G";
    }
    else if(b=='G'){
        cout << "C";
    }
    else{
        cout << "A";
    }
	return 0;
}

Measured memory_bytes: 256
program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) a,b,c
    write(*,*)int((c+0.5)/a)*b
    stop
end program sample
  



Measured memory_bytes: 2768
a = gets.chomp!.to_i
 
array = gets.chomp!.split(" ").map(&:to_i)
list = []
array.each do |num|
    if num%2 == 0
        list << num
    end
end
judge = []
list.each do |num|
  if num%3==0 || num%5==0
    judge << 1
  else
    judge << 0
  end
end
 
if judge.index(0)
	puts "DENIED"
else
  puts "APPROVED"
end

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

signed main(void)
{
	string a, b;
	int num;

	cin >> a >> b;
	a += b;
	num = stoi(a);
	if ((int)sqrt(num) * (int)sqrt(num) == num)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
using pii = pair<int, int>;

#define rep(i,k,n) for(int i=(k); i != int(n); ++i)
#define sz(x) x.size()
#define all(x) x.begin(), x.end()

#define dbg(x) cout << #x << '=' << x << '\n'
#define dbg2(x, y) cout << #x << '=' << x << ' ' << #y << '=' << y << '\n' 

#define input() (*istream_iterator<int>(cin))
#define strin() (*istream_iterator<string>(cin))
#define output(x) cout << x << '\n' 

int main(){
    ios::sync_with_stdio(false);
    double r;
    cin >> r;
    cout << 2*M_PI*r;
}

Measured memory_bytes: 3816
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N + 1];
		for (int i = 0; i < N; i++) {
			A[i + 1] = sc.nextInt();
		}
		sc.close();

		// 逆順に見ていく
		for (int i = N; i >= 1; i--) {
			int sum = A[i];
			for (int j = i * 2; j <= N; j += i) {
				sum += A[j];
			}
			if (sum % 2 != A[i]) {
				if (A[i] == 0) {
					A[i] = 1;
				} else {
					A[i] = 0;
				}
			}
		}

		int ans = 0;
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 1; i <= N; i++) {
			if (A[i] == 1) {
				ans++;
				list.add(i);
			}
		}

		System.out.println(ans);
		for (int cnt : list) {
			System.out.print(cnt + " ");
		}
	}
}


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

int main(){
	int T;
	double a,b,c,d,e,f;
	while(cin >> a >> b >> c >> d >> e >> f){
		double D = a*e-b*d;
		double x = c*e-b*f;
		double y = a*f-c*d;
		x /= D;
		y /= D;
		x += 1e-9;
		y += 1e-9;
		printf("%.3lf %.3lf\n",x,y);
	}
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s, t;
	cin >> s >> t;

	int n=s.length(), ans=0;
	for(int i=0; i<n; ++i){
		if(s[i]!=t[i]) ++ans;
	} 
	cout << ans << endl;
}

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

a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

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

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

using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7;

ll addMod(ll a, ll b){
	return (a+b) % MOD;
}

ll mulMod(ll a, ll b){
	return (a*b) % MOD;
}

ll fast(ll a, ll b){
	if(b == 0) return 1;
	ll tmp = fast(a,b/2);
	tmp = mulMod(tmp,tmp);
	if(b % 2 == 1) tmp = mulMod(tmp,a);
	return tmp;
}

const int N = 2e5;

ll fact[N + 5];
ll nCk(int n, int k){
	if(n < k) return 0;
	return mulMod(fact[n], fast(mulMod(fact[n-k], fact[k]), MOD-2));
}

ll f(ll n, ll m, ll k){
	ll ret = 0;
	for(int dif = 1; dif <= n-1; dif++){
		ll val = mulMod(n-dif, m*m);
		val = mulMod(val, nCk(n*m-2,k-2));
		val = mulMod(val, dif);
		ret = addMod(ret, val);
	}
//	printf("ret %lld\n",ret);
	return ret;
}

ll solve(ll n, ll m, ll k){
	ll ret = addMod(f(n,m,k), f(m,n,k));
	return ret;
}

int main(){
	fact[0] = 1;
	for(int i=1; i<=N; i++) fact[i] = mulMod(fact[i-1], (ll)i);
	ll n,m,k;
	cin >> n >> m >> k;
	cout << solve(n,m,k) << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
#define mod_ceil(a, b) (a % b) ? a / b + 1 : a / b
#define o5 100100
using namespace std;

vector<ll> G[o5];
vector<ll> path;
vector<bool> V(o5, false);

void find_path(ll n)
{
    stack<ll> S;
    vector<bool> vis(n, false);
    ll tp;
    bool found = false;
    S.push(0);
    while (true)
    {
        tp = S.top();
        if (vis[tp])
        {
            S.pop();
        }
        else
        {
            vis[tp] = true;
            for (ll i = 0; i < G[tp].size(); i++)
            {
                ll tmp = G[tp][i];
                if (!vis[tmp])
                {
                    S.push(tmp);
                }
                if (tmp == n)
                {
                    vis[tmp] = true;
                    found = true;
                    break;
                }
            }
            if (found)
                break;
        }
    }
    while (!S.empty())
    {
        if (vis[S.top()])
            path.push_back(S.top());
        S.pop();
    }
}

ll count_child(ll root)
{
    ll count = 1;
    stack<ll> S;
    S.push(root);
    V[root] = false;
    while (!S.empty())
    {
        ll tp = S.top();
        if (V[tp])
        {
            S.pop();
        }
        else
        {
            V[tp] = true;
            for (ll i = 0; i < G[tp].size(); i++)
            {
                ll el = G[tp][i];
                if (!V[el])
                {
                    S.push(el);
                    count++;
                }
            }
        }
    }
    return count;
}

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

    ll n, x, y;
    cin >> n;
    for (ll i = 0; i < n - 1; i++)
    {
        cin >> x >> y;
        x--;
        y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }

    find_path(n - 1);
    vector<ll> childs;
    for (auto i : path)
    {
        V[i] = true;
    }
    for (auto i : path)
    {
        childs.push_back(count_child(i));
    }
    ll ln = path.size() / 2;
    y = accumulate(childs.begin(), childs.begin() + ln, 0);
    x = accumulate(childs.begin() + ln, childs.end(), 0);
    if (x > y)
    {
        cout << "Fennec" << endl;
    }
    else
    {
        cout << "Snuke" << endl;
    }
}

Measured memory_bytes: 11656
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define fi first
#define se second 

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

// End of template code!
int main() 
{
    int x;
    scanf("%d", &x); 
    printf("%.10lf\n", 2. * x * M_PI);
    return 0;
}



Measured memory_bytes: 3832
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

int n;
int a[maxn];

int main() {
    ll ans=5e18;
    n=read();
    for(int i=1; i<=n; ++i) a[i]=read();
    for(int i=1; i<=100; ++i) {
        ll tmp=0;
        for(int j=1; j<=n; ++j) tmp+=(a[j]-i)*(a[j]-i);
        ans=min(ans,tmp);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(a) cout << (a) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
// Int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    Int n;
    cin >> n;
    vector<Int> l(n);
    for (Int i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(), l.end());
    Int sum = 0;
    for (Int i = 0; i < n - 1; i++) sum += l[i];
    dump(sum > l.back() ? "Yes" : "No");
    return 0;  
} 

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

void kansuu(int64_t n, vector<int64_t> &yakusuu)
{
	for (int64_t i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			if (i != 1) {
				yakusuu.push_back(i);
			}
			if (n / i != i) {
				yakusuu.push_back(n / i);
			}
		}
	}
}

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

	int cnt = 0;

	// KがNの約数である場合
	vector<int64_t> n_yakusuu;
	kansuu(n, n_yakusuu);
	for (auto n_yakusuu_ele : n_yakusuu) {
		int64_t temp = n;
		while (temp >= n_yakusuu_ele) {
			if (temp % n_yakusuu_ele == 0) {
				temp /= n_yakusuu_ele;
			} else {
				temp %= n_yakusuu_ele;
			}
		}
		if (temp == 1) {
			cnt++;
		}
	}

	// KがNの約数でない場合
	vector<int64_t> n1_yakusuu;
	kansuu(n - 1, n1_yakusuu);
	cnt += n1_yakusuu.size();

	cout << cnt << endl;

}



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


int main()
{
    int n;
    cin>>n;
    int l[101];
    int total=0;
    for(int i=0;i<n;i++)
    {
        cin>>l[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(l[i]!=l[j] && l[i]!=l[k] && l[j]!= l[k])
                {
                    if(l[i]+l[j]>l[k] && l[j]+l[k]>l[i] && l[i]+l[k]>l[j])
                    {
                        total++;
                    }
                }
            }
        }
    }
    cout<<total;
}


Measured memory_bytes: 3636
N = int(input())
A = list(map(int,input().split()))
cnt = 0
for i in range(N):
    minj = i
    for j in range(i+1,N):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        A[i],A[minj] = A[minj],A[i]
        cnt += 1
print(*A)
print(cnt)



Measured memory_bytes: 5612
fun main(){
    val s = readLine()!!.toString()
    val n = s.length

    fun palindrome(s: String): Boolean{
//        println(s)
//        println(s.length)
        for(i in 0 .. (s.length-1)/2){
            if(s[i] != s[s.length - 1 - i])
                return false
        }
        return true
    }

    //substring; 終了インデックスの１つ前までで切る
    if(
            palindrome(s) &&
            palindrome(s.substring(0, (n - 1)/2)) &&
            palindrome(s.substring((n + 3)/2 - 1   , n))
    ) println("Yes")
    else println("No")
}

Measured memory_bytes: 34504
#include <iostream>
#include <vector>
#include <algorithm>
#include<stdio.h>
#include<functional>
using namespace std;
typedef long long ll;
int main() {
    int H;
    int W;
    int h;
    int w;
    cin >> H>>W>>h>>w;
    int ans;
    ans=H*W-h*W-(H-h)*w;
    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

int main() {

	double x1, x2, x3;
	double y1, y2, y3;
	double a, b, c;
	double r1, r2, r3;
	double d,e,f;
	double r, s;
	double ix, iy;

	scanf("%lf %lf", &x1, &y1);
	scanf("%lf %lf", &x2, &y2);
	scanf("%lf %lf", &x3, &y3);

    while( x1 != 0 || x2 != 0 || x3 != 0 ||
    	   y1 != 0 || y2 != 0 || y3 != 0){

    	// from wikipedia: https://en.wikipedia.org/wiki/Malfatti_circles#Radius_formula
    	c = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
     	a = sqrt((x2-x3)*(x2-x3) + (y2-y3)*(y2-y3));
    	b = sqrt((x3-x1)*(x3-x1) + (y3-y1)*(y3-y1));
    	// std::cout << a << " " << b << " " << c << std::endl;

    	s = (a+b+c) / 2;
    	// std::cout << s <<std::endl;

    	// formula for incenter of a triange
    	// http://mathworld.wolfram.com/Incenter.html
    	ix = (a*x1 + b*x2 + c*x3) / (a+b+c);
    	iy = (a*y1 + b*y2 + c*y3) / (a+b+c);

    	// std::cout << ix << " " << iy << std::endl;
    	d = sqrt((ix-x1)*(ix-x1) + (iy-y1)*(iy-y1));
    	e = sqrt((ix-x2)*(ix-x2) + (iy-y2)*(iy-y2));
    	f = sqrt((ix-x3)*(ix-x3) + (iy-y3)*(iy-y3));

    	// std::cout << d << " " << e << " " << f << std::endl;

    	r=sqrt(s*(s-a)*(s-b)*(s-c))/s;

    	r1 = r*(s-r+d-e-f)/(2*(s-a));
    	r2 = r*(s-r-d+e-f)/(2*(s-b));
    	r3 = r*(s-r-d-e+f)/(2*(s-c));

    	printf("%lf %lf %lf\n", r1, r2, r3);
	    
		scanf("%lf %lf", &x1, &y1);
		scanf("%lf %lf", &x2, &y2);
		scanf("%lf %lf", &x3, &y3);
    }
    return 0;
}




Measured memory_bytes: 2684
import java.io.*
import java.util.*

const val YES = "Yes"
const val NO = "No"
fun solve(S: String){
    val oddChars = setOf('R', 'U', 'D')
    val evenChars = setOf('L', 'U', 'D')
    S.mapIndexed{ index, value -> if(index % 2 == 0) value in oddChars else value in evenChars }.all{ it }.let{
        if(it){ println(YES) }
        else println(NO)
    }
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val S = sc.next()
    solve(S)
}



Measured memory_bytes: 33844
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,ans,chk;
    string st;
    string st1;
    string st2;
    string st3;
    cin>>st;
    chk=0;
    ll chk1=0;
    ll chk2=0;
    a=st.size();
    st1=st;
    st2=st;
    n=a-1;
    reverse(st1.begin(),st1.end());
    if(st1==st) chk++;
    b=(a-1)/2;
    n=b-1;
    for(int i=0; i<(b/2); i++)
    {
        swap(st2[i],st2[n]);
        n = n-1;
    }
    for(i=0; i<b; i++)
    {
        if(st2[i]==st[i]) chk1++;
    }
    if(chk1==b) chk++;
    c=(a+3)/2;

    for(int i=c-1; i<a; i++)
    {
        st3+=st[i];
    }
        reverse(st3.begin(), st3.end());
    d=st3.size();
    for(i=0; i<d; i++)
    {
        if(st3[i]==st[i+c-1]) chk2++;
    }
    if(chk2==d) chk++;
    if(chk==3) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int s,i;
	int a,b;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		s=s+b-a+1;
	}
	cout<<s<<endl;
	return 0; 
}

Measured memory_bytes: 256