akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const int INF = 100000000;
const int MAX_N = 100;
typedef pair<int , int> P;
typedef long long ll;
 
int main () {
  int N, ans;
  ans = 0;
  cin >> N;
  string x;
  map<string, int> dict;
  for (int i = 0; i < N; ++i) {
    cin >> x;
    ++dict[x];
    ++ans;
    if (dict[x] != 1) {
      --ans;
      --dict[x];
    }
  }
  printf("%d\n", ans);
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  int ans=0;
  int c[2][100];
  for(int i=0;i<2;i++){
    for(int j=0;j<n;j++){
      cin>>c[i][j];
    }
  }
  for(int i=0;i<n;i++){
    int sum=0;
    for(int j=0;j<n;j++){
      if(j<=i)sum+=c[0][j];
      if(i<=j)sum+=c[1][j];
    }
    if(sum>ans)ans=sum;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;


int main(){
    int h,w;
    cin>>h>>w;
    vector<string> G(h);
    for(int i=0;i<h;i++) cin>>G[i];

    vector<string> buf;
    for(int i=0;i<h;i++){
        bool f=true;
        for(int j=0;j<w;j++){
            if(G[i][j]=='#') f=false;
        }
        if(!f) buf.push_back(G[i]);
    }

    for(int j=0;j<w;j++){
        bool f=true;
        for(int i=0;i<buf.size();i++){
            if(buf[i][j]=='#') f=false;
        }
        if(f){
            for(int i=0;i<buf.size();i++){
                buf[i][j]='?';
            }
        }
    }

    for(int i=0;i<buf.size();i++){
        for(int j=0;j<w;j++){
            if(buf[i][j]=='?') continue;
            cout<<buf[i][j];
        }
        cout<<endl;
    }

}

Measured memory_bytes: 3624
@n,@a,@b,@c = gets.chomp.split.map(&:to_i)
@l = []

@n.times do |i|
  @l << gets.chomp.to_i
end

def dfs(i, a, b, c, cost)
  if i == @n
    return 10**10 if a * b * c == 0

    # 最世の1つ目でもコスト10かかってしまってるので30を引く
    return (@a-a).abs + (@b-b).abs + (@c-c).abs + cost - 30
  end

  x = dfs(i+1, a, b, c, cost)
  y = dfs(i+1, a+@l[i], b, c, cost+10 )
  z = dfs(i+1, a, b+@l[i], c, cost+10 )
  w = dfs(i+1, a, b, c+@l[i], cost+10 )

  return [x,y,z,w].min
end

puts dfs(0,0,0,0,0)



Measured memory_bytes: 1788
N, K = [int(s) for s in input().split()]
R, S, P = [int(s) for s in input().split()]
T = input()
own_win = [False] * N


def win(t):
    if t == 'r':
        return P
    elif t == 's':
        return R
    else:
        return S


def janken(i):
    if i >= K:
        if T[i] != T[i - K] or own_win[i - K] is False:
            own_win[i] = True
            return win(T[i])
        else:
            return 0
    else:
        own_win[i] = True
        return win(T[i])


cnt = 0
for i in range(N):
    cnt += janken(i)

print(cnt)

Measured memory_bytes: 74400
///   ***   ---   |||         In the name of ALLAH        |||   ---   ***   ///



#include<bits/stdc++.h>
using namespace std;


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define mod 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }


main()
{
    optimize();
int n,p,i,j,c=0;
cin>>n>>p;
map<int,int>m;
int k[n+1];
for(i=1;i<=n;i++)
{
    cin>>k[i];
    int a[k[i]+1];
    for(j=1;j<=k[i];j++)
    {
        cin>>a[j];
        m[a[j]]++;
    }
}
for(auto u:m)
{
    if(u.S==n)
        c++;
}
cout<<c<<endl;


















    return 0;
}











































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

using namespace std;

const int N = 305;

int n, a[N], x, y, z;
double f[N][N][N];

double calc (int x, int y, int z) {
    if (x == 0 && y == 0 && z == 0) return 0;
    if (f[x][y][z] >= 0) return f[x][y][z];
    double ans = 1.0 * n / (x + y + z);
    if (x) ans += calc(x - 1, y, z) * x / (x + y + z);
    if (y) ans += calc(x + 1, y - 1, z) * y / (x + y + z);
    if (z) ans += calc(x, y + 1, z - 1) * z / (x + y + z);
    return f[x][y][z] = ans;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n; memset(f, -1, sizeof(f));
    for (int i = 1; i <= n; i++) cin >> a[i], x += (a[i] == 1), y += (a[i] == 2), z += (a[i] == 3);
    cout << fixed << setprecision(10) << calc(x, y, z);
    return 0;
}


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

int main(){
  long N;
  cin  >> N;
  vector<long> H(N);
  for(long i=0;i<N;i++){
    cin >> H.at(i);
  }
    
  if(N == 1){
    cout << 0 << endl;
  }
  else{
    vector<long>A(N);
    for(long i=0;i<N;i++){
      A.at(i)=0;
    }
  
    for(long i=0;i<N-1;i++){
      if(H.at(i) >= H.at(i+1)){
        A.at(0)++;
      }
      else{
        break;
      }
    }
  
    for(long i=1;i<N;i++){
      if(A.at(i-1)==0){
        for(long j=i;j<N;j++){
          if(H.at(j-1) >= H.at(j)){
            A.at(i)++;
          }
          else{
            break;
          }
        }
      }
      else{
        A.at(i)=A.at(i-1) -1;
      }
    }
    
    
    sort(A.begin(),A.end());
  
    cout << A.at(N-1) << endl;
    
  }
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N, Alice;
	bool flag = true;
	cin >> N;
	vector<int> vec(N);

	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}

	sort(vec.begin(), vec.end());	//小さい順に並び替え
	reverse(vec.begin(), vec.end());//大きい順に並び替え

	Alice = 0;
	for (int i = 0; i < N; i++) {
		if (flag) {
			Alice += vec.at(i);
			flag = false;
		}
		else {
			Alice -= vec.at(i);
			flag = true;
		}
	}
	cout << Alice << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end() 
#define SZ(x) (int)x.size()
#define f first
#define s second
const int MAXN=7;
const int MAXK=18;
const int INF = 1e9;
const ll MOD = 1e9+7;

ll N,R,C,K,a,b;
vi A;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll ans=0;
	cin>>N;
	for(int i=1;i<=N;++i){
		ans+=i*(N-i+1);
	}
	for(int i=1;i<N;++i){
		cin>>a>>b;
		if(a>b)swap(a,b);
		ll r=a*(N-b+1);
		ans-=r;
	}
	cout<<ans;
}

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

int main() {
  int k, x;
  cin >> k >> x;
  for (int i = x-k+1; i <= x+k-1; i++) {
    printf("%d\n", i);
  }
  return 0;
}

Measured memory_bytes: 256
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
#define DD 1
#else
#define DD 0
#endif
#define Debug if(DD) printf("line %d\n",__LINE__)
#define deb(x) if(DD) cerr<<#x<<'='<<x<<endl
#define debug if(DD) printf
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void gg1(){write2(-1);exit(0);}
	void gg2(){puts("NO");exit(0);}
	
	const double eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int N=1e6+10;
	
	int a[N],mx[N];
	int dec[N];
	void main()
	{
		int a=qread(),b=qread();if(a<b) swap(a,b);
		while(a--) write(b);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	#endif
	srand(time(0));
	mine::main();
	if(DD) cerr<<"Time: " <<1.0*clock()/CLOCKS_PER_SEC<<"s";
}

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

int main() {
	
	int n;
	string s;
	cin >> n >> s;
	int cnt=0;
	for(int i=1; i<n; i++){
		if(s.at(i)==s.at(i-1)) cnt++;
	}
	cout << n-cnt << endl;
	
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Linq;

class F
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		var n = h[0];
		var map = new int[h[1]].Select(_ => read()).ToLookup(r => r[0], r => r[1]);

		var m = double.MaxValue;
		for (int k = 1; k < n; k++)
		{
			var dp = new double[n + 1];
			for (int i = n - 1; i > 0; i--)
			{
				var count = map[i].Count();
				if (i == k && count > 1)
				{
					var sum = 0.0;
					var max = 0.0;
					foreach (var j in map[i])
					{
						sum += dp[j];
						max = Math.Max(max, dp[j]);
					}
					dp[i] = (sum - max) / (count - 1) + 1;
				}
				else
				{
					var sum = 0.0;
					foreach (var j in map[i])
					{
						sum += dp[j];
					}
					dp[i] = sum / count + 1;
				}
			}
			m = Math.Min(m, dp[1]);
		}
		Console.WriteLine(m);
	}
}


Measured memory_bytes: 20624
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000001;
const long long LINF = 1e18;
const int MAX = 510000;

int main() {
	int cnt = 0;
	vector<int> a(3);
	cin >> a.at(0) >> a.at(1) >> a.at(2);
	sort(a.begin(), a.end());
	while (a.at(0) != a.at(1) || a.at(1) != a.at(2)) {
		if (a.at(1) != a.at(2)) {
			a.at(0)++;
			a.at(1)++;
			cnt++;
		}
		else if (a.at(1) == a.at(2) && a.at(0) != a.at(1)) {
			a.at(0) += 2;
			cnt++;
		}
		sort(a.begin(), a.end());

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


Measured memory_bytes: 3592
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    char s1[105],s2[105],s3[105];
    int sign=1,mark1=0,mark2=0,mark3=0;
    cin>>s1;
    cin>>s2;
    cin>>s3;
    while(1)
    {
        if(sign==1)
        {
            if(mark1>=strlen(s1))
            {
                sign=1;break;
            }
            sign=(s1[mark1]-'a'+1);
            mark1++;
        }
        else if(sign==2)
        {
            if(mark2>=strlen(s2))
            {
                sign=2;break;
            }
            sign=(s2[mark2]-'a'+1);
            mark2++;
        }
        else
        {
            if(mark3>=strlen(s3))
            {
                sign=3;break;
            }
            sign=(s3[mark3]-'a'+1);
            mark3++;
        }
    }
    printf("%c\n",'A'+sign-1);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    Lcm(a,b)  ((a*b)/(__gcd(a,b)))
#define    clr(v,d)      memset( v, d ,sizeof(v))
typedef  long long     ll ;
typedef  unsigned long long     ull ;
const long double eps= (1e-9);
using namespace std;
using namespace __gnu_pbds;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=0;

int main(){
    GO();

    int n;
    cin>>n;
    n%=10;
    if(n==2||n==4||n==5||n==7||n==9) cout<<"hon\n";
    if(n==1||n==0||n==6||n==8) cout<<"pon\n";
    if(n==3) cout<<"bon\n";
}

























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

const double PI=acos(-1.0);

const int nmax = 8;
bool g[nmax][nmax];

int dfs(int p, int N, bool seen[nmax]) {
    bool all_seen = true;

    rep(i, N) if(!seen[i]) all_seen = false;

    if(all_seen) return 1;

    int ret = 0;
    rep(i, N) {
        if(!g[p][i]) continue;
        if(seen[i]) continue;

        seen[i] = true;
        ret += dfs(i, N, seen);
        seen[i] = false;
    }

    return ret;
}

int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a][b] = g[b][a] = true;
    }

    bool seen[nmax];
    rep(i, n) seen[i] = false;

    seen[0] = true;

    cout << dfs(0, n, seen) << endl;
    
    return 0;
}



Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    a = int(input())
    b = int(input())
    h = int(input())
    print((a + b) * h // 2)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
vector<pair<pair<ll,ll>,ll> >v;
vector<pair<ll,ll> >g[N];
bool vstd[N];
ll ans;
int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		ll a,b;cin>>a>>b;
		v.push_back({{a,b},i});
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n-1;i++){
		g[v[i].second].push_back({v[i+1].second,v[i+1].first.first-v[i].first.first});
		g[v[i+1].second].push_back({v[i].second,v[i+1].first.first-v[i].first.first});
	}
	for(int i=0;i<v.size();i++){
		swap(v[i].first.first,v[i].first.second);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n-1;i++){
		g[v[i].second].push_back({v[i+1].second,v[i+1].first.first-v[i].first.first});
		g[v[i+1].second].push_back({v[i].second,v[i+1].first.first-v[i].first.first});
	}
	priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >pq;
	pq.push(make_pair(0,1));
	while(pq.size()){
		int node=pq.top().second;ll cost=pq.top().first;
		pq.pop();
		if(vstd[node])continue;
		vstd[node]=true;
		ans+=cost;
		for(auto u:g[node]){
			pq.push({u.second,u.first});
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 22000
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m;
	cin>>n>>m;
	int c=0;
	while(n>0){
		c++;
		n/=m;
	}
	cout<<c<<endl;
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;
const int maxn = 2000005;
ll pre[maxn];
ll inv[maxn];
ll prei[maxn];
void build(int n){
    pre[1] = pre[0] = 1, inv[1] = inv[0] = 1, prei[1] = prei[0] = 1;
    for(int i = 2 ; i <= n ; i++){
        pre[i] = pre[i-1] * i % mod;
        inv[i] = (mod - mod / i * inv[mod % i] % mod) % mod;
        prei[i] = prei[i-1] * inv[i] % mod;
    }
}
ll C(int n, int k){
    return pre[n] * prei[k] % mod * prei[n-k] % mod;
}
ll P(int n, int k) {
    return pre[n] * prei[n - k] % mod;
}
void solve() {
    ll n, m;
    cin >> n >> m;
    ll ans1 = 1;
    f(n) {
        ans1 *= (m - i);
        ans1 %= mod; 
    }
    build(m);
    ll ans2 = 0;
    ll pl = 1;
    for (int i = 0 ; i <= n ; i++) {
        ans2 += pl * C(n, i) * P(m - i, n - i) % mod;
        ans2 += mod;
        ans2 %= mod;
        pl = -pl;
    }
    cout << ans1 * ans2 % mod << '\n';
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int c = 0;
    int t;
    if (!c) {
        t = 1;
    }
    else {
        cin >> t;
    }
    while (t--) {
        solve();
    }
}

Measured memory_bytes: 15264
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#define fi first
#define se second
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	int w;
	int n;
	int y;
	char c;
	int a[35],b[35];
	int x[35];
	cin>>w>>n;
	for(int i=1;i<=w;i++) x[i]=i;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>c>>b[i];
	}
	for(int i=1;i<=n;i++){
		y=x[a[i]];
		x[a[i]]=x[b[i]];
		x[b[i]]=y;
	}
	for(int i=1;i<=w;i++){
		cout<<x[i]<<endl;
	}
}

Measured memory_bytes: 3052
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(char b) { return "'" + string(1, b) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) {
	string res = "{";
	for (const auto& x : v) res += (res == "{" ? "" : ", ") + to_string(x);
	return res + "}";
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug(T...);
}
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define db(...) 42
#endif
typedef long long ll;
typedef long double ld;
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	fenwick_tree<ll> fenw(n);
	for (int i = 0; i < n; ++i) {
		int a;
		scanf("%d", &a);
		fenw.add(i, a);
	}
	while (q--) {
		int t, u, v;
		scanf("%d%d%d", &t, &u, &v);
		if (t == 0) fenw.add(u, v);
		else printf("%lld\n", fenw.sum(u, v));
	}
}


Measured memory_bytes: 8228
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)





int N, M;
int A[1010];
//-----------------------------------------------------------------------------------
int ans = 0;
int f(int L, int R) {
	if (L == R) return A[L];

	int d = R - L + 1;
	int a = f(L, L + d / 2 - 1);
	int b = f(L + d / 2, R);
	if (a && b) ans++;
	if (!a && !b) return 0;
	return 1;
}
//-----------------------------------------------------------------------------------
int main() {
	cin >> N >> M;
	rep(i, 0, N) A[i] = 1;
	rep(i, 0, M) {
		int a; cin >> a; A[a] = 0;
	}

	f(0, N - 1);
	cout << ans << endl;
}

Measured memory_bytes: 3036
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    ll n, m; cin >> n >> m;
    if (n == 2 || m == 0) {
        cout << 0 << endl;
    } else if (n == 1 && m == 1) {
        cout << 1 << endl;
    } else if (n == 1) {
        cout << m - 2 << endl;
    } else if (m == 1) {
        cout << n - 2 << endl;
    } else {
        cout << (n-2) * (m-2) << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
int L[200000];
int R[200000];
int A[200000];
 int main() {
	 int N;
	 cin >> N;
	 for (int i = 0; i < N; i++) cin >> A[i];
	 L[0] = A[0];
	 for (int i = 1; i < N; i++) L[i] = max(L[i - 1], A[i]);
	 R[N - 1] = A[N - 1];
	 for (int i = N - 2; i >= 0; i--) R[i] = max(R[i + 1], A[i]);
	 for (int i = 0; i < N; i++) {
		 int ans = 0;
		 if (i > 0) ans = max(ans, L[i - 1]);
		 if (i + 1 < N) ans = max(ans, R[i + 1]);
		 cout << ans << endl;
	 }
}

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

#define    ll     long long int

int main( )
{
    ll i, n, ans = 1, t;
    cin >> n;
    n--;
    cin >> ans;
    while (n--) {
        cin >> t;
        ll g = __gcd(ans, t);
        ans = (ans / g) * t;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n):
    if l[i]==i+1:
        ans+=1
        if i!=n-1:
            temp=l[i]
            l[i]=l[i+1]
            l[i+1]=temp
        else:
            temp=l[i]
            l[i]=l[i-1]
            l[i-1]=temp
print(ans)
            

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
long long dp[405][405][405];
long long MOD=998244353;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s;
	int K;
	cin>>s>>K;
	vector<int>v;
	int cnt=0, ones=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='0'){
			v.push_back(cnt);
			cnt=0;
		}
		else{
			cnt++;
			ones++;
		}
		if(i+1==s.size()) v.push_back(cnt);
	}
	//for(int i:v) cout<<i<<endl;
	int n=v.size(), MAXN=ones;
	memset(dp, 0, sizeof dp);
	for(int i=0;i<n;i++){
		for(int j=0;j<=MAXN;j++){
			for(int k=0;k<=MAXN;k++){
				if(j<k) continue;
				if(i==0){
					if(j==k) dp[i][j][k]=1;
					continue;
				}
				for(int a=0;a<=v[i];a++){
					if(k+a>MAXN) break;
					dp[i][j][k]+=dp[i-1][j][k+a];
					//if(i==1 && j==1 && k==0) cout<<i-1<<" "<<j<<" "<<k+a<<endl;
				}
				for(int a=1;a<=k;a++){
					if(j-a<0 || k-a>MAXN) break;
					dp[i][j][k]+=dp[i-1][j-a][k-a];
					//if(i==1 && j==1 && k==0) cout<<i-1<<" "<<j-a<<" "<<k-a<<endl;
				}
				dp[i][j][k]%=MOD;
				//cout<<i<<" "<<j<<" "<<k<<": "<<dp[i][j][k]<<endl;
			}
		}
	}
	long long ans=0;
	for(int i=0;i<=min(K, MAXN);i++){
		ans=(ans+dp[n-1][i][0])%MOD;
	}
	cout<<ans;
}


Measured memory_bytes: 522628
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    int n;
    cin >> n;
    unordered_map<string, int> cnt;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        ++cnt[s];
    }
    int64_t res = 0;
    for (auto p : cnt) {
        res += p.second * 1LL * (p.second - 1) / 2;
    }
    cout << res << endl;
}

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

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

Measured memory_bytes: 10660
#include<stdio.h>
int main(){
  int n,i,j,d[200][3];
  int s[200]={0};
  scanf("%d",&n);
  for(i=0;i<n*3;i++)scanf("%d",&d[i/3][i%3]);
  for(i=0;i<3;i++){
    char c[101]={0};
    for(j=0;j<n;j++)c[d[j][i]]++;
    for(j=0;j<n;j++){
      if(c[d[j][i]]==1)s[j]+=d[j][i];
    }
  }
  for(i=0;i<n;i++)printf("%d\n",s[i]);
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int main(){
  int i,j,k;
  int r,c;
  int b;
  cin >> r >> c;
  int rsum[100]={};
  int csum[100]={};
  int sum=0;
  for(i=0;i<r;i++){
    cin >> b;
    cout << b;
    rsum[i]+=b;
    csum[0]+=b; 
    for(j=1;j<c;j++){
      cin >> b;
      cout <<" " << b;
      rsum[i]+=b;
      csum[j]+=b; 
    }
    cout << " " << rsum[i] << endl;
    sum+=rsum[i];
  }
  cout << csum[0];
  for(j=1;j<c;j++){
    cout << " " << csum[j];    
  }
  cout << " " << sum <<  endl;
  return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  
  vector<ull> ai;
  
  ull sum = 0;
  
  while (n--) {
    ull k;
    cin >> k;
    
    sum += k;
    
    ai.pb(k);
  }
  
  ull res = 2020202020*200000;
  
  ull ls = 0;

  for (ull i = 0; i < ai.size(); ++i) {
    ls += ai.at(i);
    ull rs = sum-ls;
    
    res = min(res, max(ls, rs) - min(ls, rs));
  }
  
  cout << res << endl;
  return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    ll n, m; cin >> n >> m;
    V<ll> l(m), r(m);
    for(int i = 0; i < m; i++){
        cin >> l[i] >> r[i];
    }
    sort(ALL(l));
    sort(ALL(r));

    ll ans = 0;
    for(int i = 1; i <= n; i++){
        if(l[m - 1] <= i && i <= r[0]) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;
    string s;
    
    for(int i = 0;i < abs(y2-y1);i++) s += "U";
    for(int i = 0;i < abs(x2-x1);i++) s += "R";
    s += "U";
    for(int i = 0;i < abs(x2-(x1-1));i++) s+= "L";
    for(int i = 0;i < abs(y2-(y1-1));i++) s += "D";
    s += "R";
    for(int i = 0;i < abs(x2-x1);i++) s += "R";
    for(int i = 0;i < abs(y2-y1);i++) s += "U";
    s += "R";
    for(int i = 0;i < abs(y2-(y1-1));i++) s += "D";
    for(int i = 0;i < abs((x2+1)-x1);i++) s += "L";
    s += "U";
    cout << s;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

ll res[sz];
 ll po (ll b, ll p) {
        return !p?1:po(b*b%mod,p/2)*(p&1?b:1)%mod;
    }
void solve(){
    ll n,k;
    cin >> n >> k;
    for(ll i=1;i<=k;i++){
        res[i] = po(k/i,n);
    }
    for(ll i=k;i>=1;i--){
        for(ll j=2*i;j<=k;j+=i){
            res[i]-=res[j];
            if(res[i] < 0)
                res[i]+=mod;
            res[i]%=mod;
        }
    }
    ll an = 0;
    for(ll i=1;i <=k;i++){
        an +=( i*res[i])%mod;
        an%=mod;
    }
    g(an);

}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
 //   cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
        solve();
        
    }
return 0;
}

Measured memory_bytes: 4368
def is_palindrome(s)
  s == s.reverse
end

S = gets.chomp
N = S.length

n1 = (N - 1) / 2
n2 = (N + 3) / 2

if is_palindrome(S) &&
   is_palindrome(S[0..n1 - 1]) &&
   is_palindrome(S[n2 - 1..N - 1])
  puts "Yes"
elsif puts "No"
end


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>  
#include<set>
#include<iterator>
#include<list>
#include<utility>
#include<cstdlib>
#include<queue>
#include<stack>
#include<bitset>
//#include<bits/stdc++.h>
#define PI  2*acos(0.0)
#define pb push_back

       
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;



int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
ll x[200005],y[200005];
ll p[200005],m[200005];

ll n;
cin>>n;


for(int i=0;i<n;i++)
{
	
		cin>>x[i]>>y[i];
		p[i]=x[i]+y[i];
		m[i]=y[i]-x[i];	
}
ll mxp=0,minp=1e9+5,mxm=0,minm=1e9+5;
for(int i=0;i<n;i++)
{
	if(mxp<p[i])
	{
		mxp=p[i];
	}
	
	if(minp>p[i])
	{
		minp=p[i];
	}
	
	if(mxm<m[i])
	{
		mxm=m[i];
	}
	if(minm>m[i])
	{
		minm=m[i];
	}
	
}

ll ans=max(mxp-minp ,  mxm-minm);


cout<<ans<<"\n";








	return 0;
	
	
	       /***Israil Hosen
	            Computer Science & Engineering
	         University Of Rajshahi.
	         ***/
	
	
	
}

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

const ll mod = 1000000007;
const int INF = 1001001001;

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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int h, w; cin >> h >> w;
	vector<string> mp(h);
	int sx, sy, gx, gy;
	cin >> sx >> sy >> gx >> gy;
	--sx; --sy; --gx; --gy;
	for(int i = 0; i < h; i++) cin >> mp[i];

	vector<vector<int>> cost(h, vector<int> (w, INF));
	cost[sx][sy] = 0;

	deque<pair<int, int>> que;
	que.push_front({sx, sy});

	while(!que.empty()){
		auto p = que.front(); que.pop_front();
		int x = p.first, y = p.second;

		// using Move A
		for(int i = 0; i < 4; i++){
			int nx = x + dx[i], ny = y + dy[i];
			if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
			if(mp[nx][ny] == '#') continue;
			if(cost[nx][ny] > cost[x][y]){
				cost[nx][ny] = cost[x][y];
				que.push_front({nx, ny});
			}
		}
		
		// using Move B
		for(int i = -2; i <= 2; i++){
			for(int j = -2; j <= 2; j++){
				if(i == 0 && j == 0) continue;
				int nx = x + i, ny = y + j;
				if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
				if(mp[nx][ny] == '#') continue;
				if(cost[nx][ny] > cost[x][y] + 1){
					cost[nx][ny] = cost[x][y] + 1;
					que.push_back({nx, ny});
				}
			}
		}
	}
	int ans = cost[gx][gy] - cost[sx][sy];
	if(ans == INF) cout << -1 << endl;
	else cout << ans << endl;
} 

Measured memory_bytes: 8732
#include <iostream>
#include <algorithm>
using namespace std;
int main() {  
  int menu[5], sum;  
  for(int i=0; i<5; i++) { 
    cin >> menu[i]; 
  }   
  sum = *min_element(menu, menu+3);
  sum+= *min_element(menu+3, menu+5); 
  sum-= 50;  
  cout << sum << endl; 
  return 0;
}


Measured memory_bytes: 1160
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
using namespace std;
int count_bit(int bit);

int main(){
    long N;
    scanf("%ld",&N);
    long X[N];
    for(int i=0;i<N;i++){
        scanf("%ld",&X[i]);
    }
    long min_dist=99999999999;
    for(int i=1;i<=100;i++){
        long sum_dist=0;
        for(int j=0;j<N;j++){
            sum_dist += (X[j]-i)*(X[j]-i);
        }
        min_dist = min(min_dist,sum_dist);
    }
    cout<<min_dist<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 998244353;
const ll INF = 1e18;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()

int main(){
	int t; cin >> t;
	ll n, m, a, b;
	while(t--){
		cin >> n >> m >> a >> b;
		cout << floor_sum(n,m,a,b) << endl;
	}
	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
#define fil(x) memset(x, 0, sizeof(x))
#define fillb(x) memset(x,false,sizeof(x))
#define fillm(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define pll pair<int, int>
#define pf printf
#define sf scanf
#define all(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define fo(i,n) for(int i=0;i<n;i++)
#define of(i,n) for(int i=n-1;i>=0;i--)
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define nl endl

typedef unsigned long long lll;
typedef long long ll;
int knigtx8[] = {2, 2, -2, -2, 1, 1, -1, -1}; ///knight move in chess
int knigty8[] = {1, -1, 1, -1, 2, -2, 2, -2}; ///knight move in chess
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; ///for 8 directions
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1}; ///for 8 directions
int dx4[] = {0, 0, 1, -1}; ///for 4 directions
int dy4[] = {1, -1, 0, 0}; ///for 4 directions
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

int atoz(){
    int frnt,bck,nibo,present,i;string s;
        frnt = abs(s[i]-present);
        bck = 26-frnt;
        nibo = min(frnt,bck);
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

int main()
{
    IOS;
    double r;
    cin>>r;
    cout<< fixed<<setprecision(20)<<2*PI*r<<endl;
    return 0;
}


Measured memory_bytes: 3804
s = input()
num = int(input())


prev = ""

n = 0

if len(s) == 1:
    print(num // 2)
else:
    if len(set(s)) == 1:
        ans = len(s) * num // 2
    
    elif s[0] == s[-1]:
        b = 1
        for i in range(1, len(s)):
            if s[0] == s[i]:
                b += 1
            else:
                start = i
                break
        
        ss = s[::-1]
        c = 1
        for i in range(1, len(s)):
            if ss[0] == ss[i]:
                c += 1
            else:
                end = i
                break
        
        for i in range(start, len(s) - end):
            if prev == s[i]:
                n += 1
                prev = ""
            else:
                prev = s[i]
        ans = ((b + c) // 2) * (num - 1)
        ans += b // 2 + c // 2
        ans += n * num

    else:
        for x in s:
            if prev == x:
                n += 1
                prev = ""
            else:
                prev = x
        ans = n * num


    print(ans)

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

#define vi vector<int>

int main() {

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

    int max_len, ans;
    string S_i;
    int j, k, l;
    ans = 0;
    for (int i = 0; i < N-1; i++) {
        // Z Algorithm
        S_i = S.substr(i, N-i);
        // cout << S_i << endl;
        j = 1;
        k = 0;
        vi A(5010, 0);
        while (j < S_i.length()) {
            while (j+k < S_i.length() && S_i[k] == S_i[j+k]) k++;
            A[j] = k;
            if (k == 0) {
                j++;
                continue;
            }
            l = 1;
            while (j+l < S_i.length() && l+A[l] < k) {
                A[j+l] = A[l];
                l++;
            }
            j += l;
            k -= l;
        }


        for (int j = 0; j < S_i.length(); j++) {
            A[j] = min(j, A[j]);
            // cout << A[j] << " " ;
        }
        // cout << endl;

        max_len =  *max_element(A.begin(), A.begin()+S_i.length());
        if (ans < max_len) {
            ans = max_len;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,i0,n) for(int i=i0;i<n;++i)
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define INF12 1000000000000 //10^12
#define INF9 1000000000 //10^9
#define MOD 10000007 //10^9+7


int main() {
    char c;
    cin >> c;
    // cout << (c+1) << endl;
    printf("%c\n", c+1);
    return 0;
}

Measured memory_bytes: 256
program em
  implicit none
  integer::N,K,C
  character(3*10**5)::S,S1
  integer,allocatable,dimension(:)::M,U
  integer::i,j
  integer::num
  read*,N,K,C
  read*,S
  allocate(M(K))
  S1=S
  num=1
  do i=1,N
    if(S1(i:i)=="o")then        
      M(num)=i
      num=num+1
      do j=1,C
        S1(i+j:i+j)="x"
      end do
      if(Num>K)exit
    endif
  end do
  S1=S
  allocate(U(K))
  num=K
  do i=N,1,-1
    if(S1(i:i)=="o")then
      U(num)=i
      num=num-1
      if(NUM<=0)exit
      do j=1,C
        if(i-j<=0)exit
        S1(i-j:i-j)="x"
      end do
    endif
  end do
  do i=1,K
    if(M(i)==U(i))print"(I0)",M(i)
  end do
  write(*,*)
contains

end program em

Measured memory_bytes: 3980
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int nega = 0;
        long ans = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (a[i] < 0)
                nega++;
            ans += Math.abs(a[i]);
            min = Math.min(min, Math.abs(a[i]));
        }

        if (nega % 2 == 0)
            System.out.println(ans);
        else
            System.out.println(ans - min * 2);

        sc.close();
    }
}

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

int main() {
    ios :: sync_with_stdio(0);
    int D; cin >> D;
    if(D == 25) cout << "Christmas";
    else if(D == 24) cout << "Christmas Eve";
    else if(D == 23) cout << "Christmas Eve Eve";
    else cout << "Christmas Eve Eve Eve" << endl;
}


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

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

  vector<double> L(N), A(N), B(N);
  for(int i=0; i<N; i++) {
    cin >> L[i] >> A[i] >> B[i];
  }

  double ans = 0.0;
  for(int bit=0; bit<(1<<N); bit++) {
    if(__builtin_popcount(bit) != M) continue;
    
    double tmp = 0.0;
    for(int i=0; i<N; i++) {
      if(!(bit >> i & 1)) continue;
      for(int j=i+1; j<N; j++) {
        if(!(bit >> j & 1)) continue;
        double diffL = (L[i] - L[j]) * (L[i] - L[j]);
        double diffA = (A[i] - A[j]) * (A[i] - A[j]);
        double diffB = (B[i] - B[j]) * (B[i] - B[j]);

        tmp += diffL + diffA + diffB;
      }
    }

    if(ans < tmp) {
      ans = tmp;
    }
  }
  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}



Measured memory_bytes: 3292
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::vec::Vec;
use std::{vec, cmp, num};


struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

// create Vec<char> from String
#[allow(dead_code)]
fn to_chars(s: String) -> vec::Vec<char> {
    let mut cs = s.chars();
    let mut res = vec::Vec::new();
    while let Some(c) = cs.next() {
        res.push(c);
    }
    res
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let a: usize = sc.read();
    let b: usize = sc.read();
    let c: usize = sc.read();
    let x: usize = sc.read();
    let mut ans: Vec<i32> = vec![0; 100001];
    for i in 0..a+1 {
        for j in 0..b+1 {
            for k in 0..c+1 {
                ans[i * 500 + j * 100 + k * 50] += 1;
            }
        }
    }
    println!("{}", ans[x]);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define debug(x) cout << x << endl
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
const LL INF64 = 1e18;

const int N = 1e5 + 5;


int main() {
	LL a, b;
	scanf("%lld %lld", &a, &b);
	LL diff = abs(a - b);
	LL tmpa = diff * (diff - 1) / 2;
	printf("%lld\n", tmpa -a);
	return 0;
}
		

Measured memory_bytes: 256
N,*A = map(int,open(0).read().split())

F = [0 for i in range(N+1)]
#F[1]=1

s = 1


for i in range(N*2):
  s = A[s-1]
  F[s]+=1
  if F[2]==1:
    print(i+1)
    exit()
  if F[s]>=2:
    print(-1)
    exit()

Measured memory_bytes: 14068
x,y = map(int,input().split())
s=[0,]
d={
  1:300000,
  2:200000,
  3:100000,
}

if x in d:
  s.append(d[x])

if y in d:
  s.append(d[y])

if x==1 and y==1:
  s.append(400000)
  
print(sum(s))


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

int intsort(const void *a, const void *b){
	return *(int*)a - *(int*)b;
}

int main(){
	int a[5],k,i;
	for(i=0;i<5;i++){
		scanf("%d",&a[i]);
	}
	scanf("%d",&k);

	qsort(a,5,sizeof(int),intsort);

	if(k<a[4]-a[0]){
		printf(":(\n");
	}else{
		printf("Yay!\n");
	}

	return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a<=b){
    rep(i,b) cout << a;
  }
  else{
   rep(i,a) cout << b;
  }
}



Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        if (x >= 0 && x >= a){
            System.out.print(10);
        } else {
            System.out.print(0);
        }
    }
}

Measured memory_bytes: 35656
use proconio::input;

#[allow(unused_variables)]
fn main() {
    input! {
      n: usize, x: isize,
      mut aa: [isize; n]
    };

    aa.sort();

    let mut total = x;
    let mut c = 0;
    let sum: isize = aa.iter().sum();

    for i in 0..n {
        if &total >= &aa[i] {
            total -= &aa[i];
            c += 1;
        } else {
            break;
        }
    }

    println!("{}", if c == n && sum != x { c - 1 } else { c });
}


Measured memory_bytes: 2148
#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
ll gcd(ll m,ll n)
{
    if(n==0)
        return m;
    return gcd(n,m%n);
}
int main()
{
    int n;
    ll a[100005];
    while(scanf("%d",&n)!=EOF)
    {
        //ll x;
        int flag1=0;
        int flag2=0;
        ll minn=inf;
        for(int i=0;i<n;i++)
        {
            scanf("%lld",&a[i]);
            minn=min(minn,a[i]);
        }
        ll x=inf;
        for(int i=0;i<n;i++)
        {
            x=min(x,gcd(minn,a[i]));
        }
        printf("%lld\n",x);
    }


    return 0;
}


Measured memory_bytes: 1024