akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
map<pair<int, int>, int> dt;
int N, Q, cur, cs, tp[40009], a[40009], b[40009], es[40009], id[40009], seq[40009]; bool vis[40009]; vector<int> g[40009], gs[40009];
void dfs(int pos) {
	id[pos] = cur;
	for (int i : g[pos]) {
		if (id[i] == -1) dfs(i);
	}
}
void dfs2(int pos) {
	vis[pos] = true;
	seq[cs++] = pos;
	for (int i : gs[pos]) {
		if (!vis[i]) dfs2(i);
	}
}
int main() {
	scanf("%d %d", &N, &Q);
	for (int i = 0; i < Q; i++) {
		scanf("%d %d %d", &tp[i], &a[i], &b[i]);
		if (tp[i] == 1) dt[make_pair(a[i], b[i])] = i, es[i] = -1;
		if (tp[i] == 2) es[dt[make_pair(a[i], b[i])]] = i;
	}
	int B = sqrt(Q);
	for (int i = 0; i < B; i++) {
		int l = i * Q / B, r = (i + 1) * Q / B;
		for (int j = 0; j < N; j++) g[j].clear();
		for (int j = 0; j < l; j++) {
			if (tp[j] == 1 && (es[j] == -1 || es[j] >= r)) {
				g[a[j]].push_back(b[j]);
				g[b[j]].push_back(a[j]);
			}
		}
		cur = 0;
		fill(id, id + N, -1);
		for (int j = 0; j < N; j++) {
			if (id[j] == -1) {
				dfs(j);
				cur++;
			}
		}
		for (int j = 0; j < cur; j++) gs[j].clear();
		for (int j = 0; j < l; j++) {
			if (tp[j] == 1 && id[a[j]] != id[b[j]] && l <= es[j] && es[j] < r) {
				gs[id[a[j]]].push_back(id[b[j]]);
				gs[id[b[j]]].push_back(id[a[j]]);
			}
		}
		for (int j = l; j < r; j++) {
			if (tp[j] == 1) {
				gs[id[a[j]]].push_back(id[b[j]]);
				gs[id[b[j]]].push_back(id[a[j]]);
			}
			if (tp[j] == 2 && id[a[j]] != id[b[j]]) {
				gs[id[a[j]]].erase(find(gs[id[a[j]]].begin(), gs[id[a[j]]].end(), id[b[j]]));
				gs[id[b[j]]].erase(find(gs[id[b[j]]].begin(), gs[id[b[j]]].end(), id[a[j]]));
			}
			if (tp[j] == 3) {
				cs = 0;
				dfs2(id[a[j]]);
				printf(vis[id[b[j]]] ? "YES\n" : "NO\n");
				for (int k = 0; k < cs; k++) vis[seq[k]] = false;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 9324
#include <bits/stdc++.h>
// D - XXOR

#define INF 0x3f3f3f3f3f3f3f3f

using namespace std;

long long dp[45][2];
long long A[100005];

int main() {
    long long N,K,i,j,cnt;

    cin >> N >> K;

    for (i = 0;i < N;i++)
        cin >> A[i];

    for (i = 0;i < 45;i++)
        for (j = 0;j < 2;j++)
            dp[i][j] = -INF;

    dp[40][1] = 0;
    for (i = 39;i >= 0;i--) {
        cnt = 0;
        for (j = 0;j < N;j++) {
            if (A[j] & (1LL << i))
                cnt++;
        }

        dp[i][0] = max(dp[i][0],dp[i + 1][0] + max(cnt,N - cnt) * (1LL << i));

        if (K & (1LL << i)) {
            dp[i][0] = max(dp[i][0],dp[i + 1][1] + cnt * (1LL << i));
            dp[i][1] = max(dp[i][1],dp[i + 1][1] + (N - cnt) * (1LL << i));
        }
        else
            dp[i][1] = max(dp[i][1],dp[i + 1][1] + cnt * (1LL << i));
    }

    cout << max(dp[0][0],dp[0][1]) << "\n";

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;

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

  ll n, k;
  cin >> n >> k;

  ll ans = 0;
  for (ll i = k; i <= n+1; ++i) {
    ll l = (i + i*i) / 2;
    ll r = i * (2*(n+1) - i + 1) / 2;

    ans += (r - l + 1);
    ans %= MOD;
  }

  cout << (ans + MOD) % MOD << '\n';

  return (0);
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <map>
#include <algorithm>

int main() {
  int N;
  std::cin >> N;

  std::map<std::string, int> a;
  for (int i = 0; i < N; ++i) {
    std::string s;
    std::cin >> s;
    ++a[s];
  }

  int M;
  std::cin >> M;
  for (int i = 0; i < M; ++i) {
    std::string t;
    std::cin >> t;
    --a[t];
  }

  int res = 0;
  for (auto& p: a)
    res = std::max(res, p.second);

  std::cout << res << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>


typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

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

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

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

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};


/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
int main() {
	int a, p,ans=0;
	cin >> a >> p;
	a = a * 3;
	ans = (a + p) / 2;
	cout << ans;
	return 0;
}










Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  vector<string> s(H);
  for(int i=0;i<H;i++)cin >> s.at(i);

  for(int i=0;i<W+2;i++)cout << "#";
  cout << endl;

  for(int i=0;i<H;i++)cout << "#" << s.at(i) << "#"<< endl;

  for(int i=0;i<W+2;i++)cout << "#";
  cout << endl;
  
}

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

int main(){
  int a,b;
  cin >> a >> b;
  int d,r;
  double f;

  d = a/b;
  r = a%b;
  f = (double)a/b;

  printf("%d %d %f\n", d, r, f);
}

Measured memory_bytes: 1184
#include<bits/stdc++.h>
using namespace std;
#define flb(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define mp make_pair
#define pb push_back
#define inf (long long)(1e18+1e15)
typedef pair<int,int> ii;
typedef vector <ll> vi;
typedef vector <pair<int,int> > vii;
typedef vector <vector <int> > vvi;
vector <ll> vis(100001,-1);
vector <ll> ans(100001,-1);
vector <vector <int> > v(100001);
ll dfs(int i)
{
    if(vis[i]!=-1)
        return ans[i];
    vis[i]=1;
    ll best=0;
    for(int j=0;j<v[i].size();j++)
    {
        int fron=v[i][j];
        best=max(best,dfs(fron)+1);
    }
    ans[i]=best;
    return ans[i];
}
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        v[x].push_back(y);

    }
    ll best=0;
    for(int i=1;i<=n;i++)
    {
        best=max(best,dfs(i));
    }
    cout<<best;
}


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


map<ll, int> prime_factor(ll n) {
	map<ll, int> ret;
	for(ll i = 2; i * i <= n; i++) {
		while(n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if(n != 1) ret[n] = 1;
	return ret;
}


int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<int> e(n + 1, 0); {
		for (int i = 2; i <= n; ++i) {
			for (auto u : prime_factor(i)) {
				e[u.first] += u.second;
			}
		}
	}

	int ans = 0;

	// 75 = (74 + 1)
	rep(i, n + 1) if (e[i] >= 74) ans++;

	// 75 = (24 + 1) * (2 + 1);
	rep(i, n + 1)rep(j, n + 1) {
		if (i == j) continue;
		if (e[i] >= 24 and e[j] >= 2) ans++;
	}

	// 75 = (14 + 1) * (4 * 1)
	rep(i, n + 1)rep(j, n + 1) {
		if (i == j) continue;
		if (e[i] >= 14 and e[j] >= 4) ans++;
	}

	// 75 = (4 + 1) * (4 + 1) + (2 + 1)
	int tans = 0;
	rep(i, n + 1)rep(j, n + 1)rep(k, n + 1) {
		if (i == j or j == k or k == i) continue;
		if (e[i] >= 4 and e[j] >= 4 and e[k] >= 2) tans++;
	}
	ans += tans / 2;

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using ll=long long;
using namespace std;

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

    if(S[S.size()-1]=='s'){
        cout<<S<<"es"<<endl;
    }else{
        cout<<S<<"s"<<endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#define WHITE 0
#define BLACK 1
#define INF 20000
#define NIL -1
#define N 1000
 
int main()
{
  int n,i,j,mincost,x,y,a=0;
  int b[N][N],d[N],p[N],q[N];
  
scanf("%d",&n);
for(i=1;i<=n;i++)
  {
    for(j=1;j<=n;j++)
      {
    scanf("%d",&b[i][j]);
      }
  }
  
for(x=1;x<=n;x++)
  {
    d[x] = INF;
    p[x] = NIL;
    q[x] = WHITE;
  }
 d[1] = 0;
  
 while(1)
   {
     mincost =INF;
     for(i=1;i<=n;i++){
     if(q[i]!=BLACK && d[i]<mincost)
       {
         mincost = d[i];
         x = i;
       }
     }
     if(mincost ==INF) break;
  
     q[x] = BLACK; 
  
     for(y=1;y<=n;y++){
       if(b[x][y] == -1) continue;
       else if(q[y]!=BLACK && b[x][y]<d[y])
	 {
	   p[y] = x;
	   d[y] = b[x][y];
	 }
     }
   }
         
 for(i=1;i<=n;i++) a += d[i];
 printf("%d\n",a);
 return 0;
}
 

Measured memory_bytes: 2856
import copy

def countKuro( t,p1,p2 ):
    count=0
    for i in range(h):
      if p1 & (1<<i) :
        for j in range(w):
            if p2 & (1<<j) :
                if t[i][j]=="#":
                    count+=1
    return count


h,w,k=map(int, input().split())
s=[]
for i in range(h):
    s.append( input() )

t=copy.copy(s)
ans=0
for i in range(1<<h):
    for j in range(1<<w):
        # print(i,j, countKuro(s,i,j))
        if k==countKuro(s, i,j):
            ans+=1
print(ans)


Measured memory_bytes: 9348
#include <bits/stdc++.h>
#define BASE 3000
#define RANGE 2500

using namespace std;
typedef long long ll;

int main() {
    int n, a, x;
    ll f[BASE*2+1], tmp[BASE*2+1];
    cin >> n >> a;
    f[BASE] = 1;
    for(int i=0; i<n; i++) {
        cin >> x;
        x -= a;
        fill(tmp, tmp+(BASE*2+1), 0);
        for(int t=BASE-RANGE; t<=BASE+RANGE; t++) {
            tmp[t+x] = f[t];
        }
        for(int t=0; t<=BASE*2; t++) {
            f[t] += tmp[t];
        }
    }
    cout << f[BASE]-1 << endl;
    
}

Measured memory_bytes: 384
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sn = new Scanner(System.in);
		int N = sn.nextInt();
		int L = sn.nextInt();
		List<String> S = new ArrayList<String>();
		for(int i = 0;i < N;++i){
			String str = sn.next();
			S.add(str);
		}
		Collections.sort(S);
		for(String str : S){
			System.out.print(str);
		}
		System.out.println();
	}
}


Measured memory_bytes: 10576
#include<bits/stdc++.h>
using namespace std;
 
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define lg long long
#define db double
#define lb(x) ((x)&-(x))
#define ft first
#define sd second
 
#define HII cerr<<"HI"<<endl
#define LLLINE cerr<<"@@@@@@@@@@@@@@@@@@@@"<<endl
 
template <class _T_>
void read(_T_& d){
	d=0;int f=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f*=-1;
	for(;c>='0'&&c<='9';c=getchar())d=d*10+c-'0';
	d*=f;
}
 
/************************************************/
#define MN 200005
int n;
int v[MN];
int t[16];
int dp[MN];
int r[MN];
int main(){
	read(n);
	for(int i=1,x,y,z;i<n;++i){
		read(x);read(y);read(z);
		v[x]^=z;v[y]^=z;
	}
	for(int i=0;i<n;++i)++t[v[i]];
	int res=0;
	int h=0;
	for(int i=1;i<16;++i){
		res+=(t[i]+1)/2;t[i]%=2;h|=t[i]*(1<<i);
	}
	memset(dp,-0x3f,sizeof dp);
	dp[0]=0;
	for(int i=0;i<h;++i){
		for(int j=0;j<16;++j)if((1<<j)&i){
			r[i]^=j;
		}
	}
	for(int i=0;i<h;++i)if(dp[i]>=0){
		int S=h-i;
		for(int j=S;j;j=S&(j-1))if(r[j]==0){
			dp[i+j]=max(dp[i]+1,dp[i+j]);
		}
	}
	cout<<res-dp[h];
	return 0;
}

Measured memory_bytes: 1664
#include <cstdio>
int main() {
    int n;
    scanf("%d", &n);
    if (n >= 65 && n <= 90) printf("%d\n", 1);
    else if (n >= 97 && n <= 122) printf("%d\n", 2);
    else printf("%d\n", 0);
    return 0;
}


Measured memory_bytes: 2760
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
typedef pair<ll, ll> P;
typedef map<string, ll> M;
typedef unordered_map<ll, ll> HM;
typedef set<ll> S;
typedef multiset<ll> MS;
typedef queue<ll> Q;

int main(){
    ll k,x; cin>>k>>x;
    for(int i=x-k+1; i<=x+k-1; i++){
        cout << i << " ";
    }
    cout << endl;
}


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

using namespace std;

int gcd(int a,int b);

int main(){
   int N,X;
   cin >> N >> X;
   int a,b;
   cin >> a;

   int ans = abs(a - X);

   for(int i=1;i<N;i++){
      cin >> a;
      b = gcd(abs(a - X), ans);
      if(ans > b){
         ans = b;
      }
   }

   cout << ans << endl;
}


int gcd(int a, int b){
   if(a > b){
      return gcd(b,a);
   }
   if(b % a == 0){
      return a;
   }
   return gcd(b%a, a);
}

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

typedef long long ll;
ll n, A, B, s, g, l, r, md, num, ans, a[100005];
int main()
{
	ll i;
	cin >> n >> A >> B;
	for (i =0; i < n; i++) {
		scanf ("%lld", &a[i]);
		s += a[i];
	}
	l = 1;
	r = s / B + 2;
	while (l < r) {
		md = (l + r) / 2;
		g = 0;
		for (i = 0; i < n; i++) {
			num = a[i] - B * md;
			if (num > 0) {
				g += num / (A - B);
				if (num % (A - B)) g++;
			}
		}
		if (g > md) l = md + 1;
		else {
			r = md;
			ans = md;
		}
	}
	cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#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 N;
    string S;
    cin >> N >> S;

    int ans = 0;
    for (int i = 0; i < N - 1; i++)
    {
        if (S[i] != S[i + 1])
        {
            ans++;
        } 
    }
    ans++;
    cout << ans << endl;
    
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define unordered_map umap
typedef long long ll;
typedef long double ld;
ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}
bool isPrime(int n){if(n<2){return false;}for(int i=2;i<sqrt(n)+1;i++){if(n%i==0) return false;}return true;}

bool in(char c,char a[],int n){
  REP(i,n){
    if(c==a[i]) return true;
  }
  return false;
}

int main(){
  int N; cin>>N;
  char march[5] = {'M','A','R','C','H'};
  map<char,ll> mp_count;
  string s;
  char c;
  REP(i,N){
    cin >> s;
    c = s[0];
    if(in(c,march,5)){mp_count[c]++;}
  }
  ll r = 0;
  r += mp_count['M']*mp_count['A']*mp_count['R'];
  r += mp_count['M']*mp_count['A']*mp_count['C'];
  r += mp_count['M']*mp_count['A']*mp_count['H'];
  r += mp_count['M']*mp_count['R']*mp_count['C'];
  r += mp_count['M']*mp_count['R']*mp_count['H'];
  r += mp_count['M']*mp_count['C']*mp_count['H'];
  r += mp_count['A']*mp_count['R']*mp_count['C'];
  r += mp_count['A']*mp_count['R']*mp_count['H'];
  r += mp_count['A']*mp_count['C']*mp_count['H'];
  r += mp_count['R']*mp_count['C']*mp_count['H'];
  printf("%Ld\n",r);
}


Measured memory_bytes: 256
#include<stdio.h>
	int main(){
		int x;
		while(scanf("%d",&x)!=EOF){
			if(x%39<10&&x%39>0)
				printf("3C0%d\n",x%39);
			else if(x%39==0)
				printf("3C39\n");
			else
				printf("3C%d\n",x%39);
		}
		return 0;
}

Measured memory_bytes: 0
from decimal import*
from fractions import*
import math
import functools


import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines 

n=(int)(input())
a=list(map(int,input().split()))
#print(type(n))
a.sort()
check=True
for i in range(n-1):
    if(a[i]==a[i+1]):
        check=False
        break
if(check):
    print("YES")
else:
    print("NO") 


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

char grade(int, int, int);

int main() {
	int m, f, r;
	char X;

	while (1) {
		cin >> m >> f >> r;
		X = grade(m, f, r);

		if (X == 'x')
			break;

		cout << X << endl;
	}
	return 0;
}

char grade(int m, int f, int r) {
	if (m == -1 && f == -1 && r == -1)
		return 'x';

	if (m == -1 || f == -1)
		return 'F';
	else if (m + f >= 80)
		return 'A';
	else if (m + f >= 65)
		return 'B';
	else if (m + f >= 50)
		return 'C';
	else if (m + f >= 30) {
		if (r >= 50)
			return 'C';
		else
			return 'D';
	}
	else
		return'F';
}

Measured memory_bytes: 1152
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

int H, W;
int N;
int a[100000];

int map[100][100] = {};

signed main()
{
	cin >> H >> W;
	cin >> N;
	REP(i, N) cin >> a[i];

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

	int cnt = 0;
	int ind = 1;

	while (true)
	{
		map[cx][cy] = ind;

		int nx = cx + dx[d];
		int ny = cy + dy[d];
		if (nx < 0 || nx >= W || ny < 0 || ny >= H || map[nx][ny] > 0)
		{
			d = (d + 1) % 4;
		}
		cx += dx[d];
		cy += dy[d];
		a[ind - 1]--;
		if (a[ind - 1] == 0)
		{
			ind++;
		}

		cnt++;
		if (cnt >= H*W) break;
	}

	REP(y, H)
	{
		REP(x, W)
		{
			cout << map[x][y] << " ";
		}
		cout << endl;
	}
}

Measured memory_bytes: 384
/*
 * atcoder/abc089/b.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }

void solve() {
  int n;cin >> n;
  loop(a,1,10) loop(b,1,10) {
    if (a*b == n) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3616
#include <stdio.h>
int main(void)
{
	int a, b, t,i,j,k;
	scanf("%d %d %d", &a, &b, &t);
	for (i = 0,j = 1,k=0; i < t + 0.5; i++) {
		if (i == j * a) {
			k = k + b;
			j++;
		}
	}
	printf("%d", k);
	return 0;
}

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

using namespace std;

int main(void)
{
    long A, B;
    char op;

    cin >> A;
    cin >> op;
    cin >> B;

    if (op == '+')
    {
        cout << A + B << endl;
    }
    else
    {
        cout << A - B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char ch;
	for (int i=1; i<=3; i++)
	{
		cin >> ch;
		if (ch=='7')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
string x;
ll n,k=0;
stack <int> a;

int main(){
	cin>>x;
	n=x.size();
	FOR(i,0,n){
		if(x[i]=='S')a.push(1);
		else{
			if(a.size()){
				a.pop();
				k+=2;
			}
		}
	}
	cout<<n-k<<endl;
	return 0;
}


Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  if(K>N){
    cout<<"NO"<<endl;
    return 0;
  }
  if(N%2==0&&N/2>=K||N%2==1&&(N/2)+1>=K){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
}

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

using namespace std;
typedef long long ll;

int a[100002], dp[100002];

int main(void) {
    int n;   
    cin >> n;
    a[0] = a[n+1] = 0;
    for(int i=1; i<=n; i++) scanf("%d", a+i);
    dp[0] = 0;
    for(int i=1; i<=n; i++) dp[i] = dp[i-1] + abs(a[i]-a[i-1]);
    dp[n+1] = dp[n] + abs(a[n]);
    for(int i=1; i<=n; i++) {
        printf("%d\n", dp[n+1] - abs(a[i]-a[i-1]) - abs(a[i+1]-a[i]) + abs(a[i+1]-a[i-1]));
    }

    return 0;
}

Measured memory_bytes: 2048
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define RG register
#define LL long long
using namespace std;
const int N=2e6+10;
struct node{ int a,b; LL c; }pt[N];
int n,m,cnt,tot,fa[N];
LL minn[N],ans;
inline bool cmp(node a,node b){return a.c<b.c;}
inline int read(){
	char ch=getchar(); int x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	return x*f;}
inline LL mi(LL a,LL b){return a<b ? a : b;}
inline int f(int son){return fa[son]= fa[son]==son ? son : f(fa[son]);}
int main()
{
	//freopen("Zigzag MST.in","r",stdin);
	n=read(); m=read();
	memset(minn,0x3f,sizeof minn);
	for(RG int i=0;i<n;i++) fa[i]=i;
	for(RG int i=1,a,b,c;i<=m;i++)
	{
		a=read()%n; b=read()%n; c=read();
		pt[++cnt]={a,b,c};
		minn[a]=mi(minn[a],c+1);
		minn[b]=mi(minn[b],c+2);
	}
	for(RG int i=1;i<2*n;i++) minn[i%n]=mi(minn[i%n],minn[(i-1)%n]+2);
	for(RG int i=0;i<n;i++) pt[++cnt]=(node){i%n,(i+1)%n,minn[i]};
	sort(pt+1,pt+1+cnt,cmp);
	for(RG int i=1;i<=cnt;i++)
	{
		int fx=f(pt[i].a), fy=f(pt[i].b);
		if(fx==fy) continue;
		fa[fx]=fy; ans+=pt[i].c;
		if(++tot==n-1) return printf("%lld\n",ans), 0;
	}
	return 0;
}

Measured memory_bytes: 27136
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<set>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
//typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll

int T[110000],A[110000];

signed main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    for(int i=0;i<110000;i++){
        T[i]=A[i]=110000;
    }
    int N,u,v;
    cin>>N>>u>>v;
    u--; v--;
    vector<int> V[110000];
    for(int i=0;i<N-1;i++){
        int a,b;
        cin>>a>>b;
        a--; b--;
        V[a].push_back(b);
        V[b].push_back(a);
    }
    queue<int> que;
    que.push(u);
    T[u]=0;
    while(!que.empty()){
        int x=que.front(); que.pop();
        for(int next:V[x]){
            if(T[next]>T[x]+1){
                T[next]=T[x]+1;
                que.push(next);
            }
        }
    }
    que.push(v);
    A[v]=0;
    while(!que.empty()){
        int x=que.front(); que.pop();
        for(int next:V[x]){
            if(A[next]>A[x]+1){
                A[next]=A[x]+1;
                que.push(next);
            }
        }
    }
    int ans=0,m;
    for(int i=0;i<N;i++){
        if(T[i]<A[i]){
            if(ans<A[i]){
                ans=A[i];
                m=i;
            }
        }
    }
    //cout<<m<<endl;
    //cout<<A[m]<<" "<<T[m]<<endl;
    cout<<A[m]-1<<endl;

}


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

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    for (int i = 0; i <= n; i++) {
        if (s == t) {
            cout << "Yes" << endl;
            return 0;
        }
        rotate(s.begin(), s.begin() + (n - 1), s.end());
    }
    cout << "No" << endl;
}


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

int k[20];
int s[20][20];
int p[20];

int main() {
    int N, M;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> k[i];
        for (int j = 0; j < k[i]; j++) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    for (int i = 0; i < M; i++) cin >> p[i];

    int ans = 0;
    for (int bit = 0; bit < (1 << N); bit++) {
        bool ok = true;
        for (int i = 0; i < M; i++) {
            int cnt = 0;
            for (int j = 0; j < k[i]; j++) {
                if (bit & (1 << s[i][j])) cnt++;
            }
            if (cnt % 2 != p[i]) {
                ok = false;
                break;
            }
        }
        if (ok) ans++;
    }

    cout << ans << endl;
}

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

const ll INF = 1LL << 60;
const int MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, b, e) for (int i = (b); i <= (e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

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

    double p1 = 0.0, p2 = 0.0;
    if (N >= K) {
        // 1回目で勝つ確率
        p1 = (double)(N-K+1)/N;
    }

    REPR(i, 1, N) {
        if (i >= K) {
            break;
        }
        int k = ceil(log2((double)K/i));
        p2 += 1.0 / (N * pow(2, k));
    }

    double ans = p1 + p2;

    cout << setprecision(20) << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <string>
#include<algorithm>
using namespace std;
const int maxn=4005;
using ll = long long;
int dp[maxn][maxn];
int main()
{
       string a,b;
       cin>>a>>b;
       memset(dp,0,sizeof(dp));
       int la=a.size(),lb=b.size();
       for(int i=1;i<=la;++i){
           for(int j=1;j<=lb;++j){
               if(a[i-1]==b[j-1]) dp[i][j]=dp[i-1][j-1]+1;
               else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
           }
       }
       if(dp[la][lb]==0) return 0;
       string ans="";
       int i=la,j=lb;
       while(i>=1&&j>=1){
            if(dp[i-1][j]==dp[i][j]) i--;
            else if(dp[i][j-1]==dp[i][j]) j--;
            else{
                ans+=a[i-1];
                i--;
                j--;
            }
       }
       reverse(ans.begin(),ans.end());
       cout<<ans<<endl;



   return 0;
}


Measured memory_bytes: 62976
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000000;
// clang-format on

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

  int ans = (800 * N) - 200 * (N / 15);
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> V(N);
	vector<int> C(N);
	for (int i = 0; i < N; i++) cin >> V[i];
	for (int i = 0; i < N; i++) cin >> C[i];

	int ans = 0;
	for (int bit = 0; bit < (1 << N); bit++) {
		int X = 0, Y = 0;
		for (int i = 0; i < N; i++) {
			if (bit & (1 << i)) {
				X += V[i];
				Y += C[i];
			}
		}
		ans = max(ans, X - Y);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

  int i,j,k,l,m;
  int n,e,s,w,un,up;
  int a[7];
int t;


void input() {
 for(i=0;i<6;i++){
  
    scanf("%d",&a[i+1]);
  
  }
}

 void N() {
   t = a[1];
   a[1] = a[2];
   a[2] = a[6];
   a[6] = a[5];
   a[5] = t;
 }

 void S() {
   t = a[1];
   a[1] = a[5];
   a[5] = a[6];
   a[6] = a[2];
   a[2] = t;
}

 void E() {
   t = a[1];
   a[1] = a[4];
   a[4] = a[6];
   a[6] = a[3];
   a[3] = t;
 }

 void W() {
   t = a[1];
   a[1] = a[3];
   a[3] = a[6];
   a[6] = a[4];
   a[4] = t;
 }

int main() {

  input();
  //  strlen(?) 文字の長さ(数)を表示
 char str[110];  
 scanf("%s",str);

 for(i=0;i<strlen(str);i++) {

   if(str[i] == 'N') {
     N();
   } else if(str[i] == 'S') {
     S();
   } else if(str[i] == 'W') {
     W();
   } else if(str[i] == 'E') {
     E();
   }
 }

 printf("%d\n",a[1]);

 return 0;
}



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

int main(void) {
    int N;
    int M;
    int i;
    int A;

    cin >> N >> M ; 
    for(i=0;i<M;i++){
        cin >> A;
        if( N >= 0) {
            N -= A;
        } else {
            N = -1;
        } 
    }

    if( N < 0) N = -1;
    cout << N << "\n"; 
    
    
    return 0;
}


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

#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();


void insertionSort(int A[],int N){
    for (int i = 0; i < N; i++)
    {
        int v = A[i];
        int j = i-1;
        while (j>=0&&A[j]>v){
            A[j+1] = A[j];
            j--;    
        }
        A[j+1] = v;
        for (int k = 0; k < N-1; k++)
        {
            printf("%d ",A[k]);
        }
        
        printf("%d\n",A[N-1]);
    }
    return ;
}




int main()
{
    int N;
    scanf("%d",&N);
    int A[N];
    for (int i = 0; i < N; i++)
    {
        scanf("%d",&A[i]);
    }
    insertionSort(A,N);
    return 0;
}



Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int mex=5000001;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 

int main()
{
  int n,k;
  cin>>n>>k;
  ll int arr[n+1],cf[n+1]={0},ans=0;
  fo(i,1,n+1)
  {
      cin>>arr[i];
      cf[i]=cf[i-1]+arr[i];
      if(i>=k)
      {
          if((cf[i]-cf[i-k])>ans)
          {
              ans=cf[i]-cf[i-k];
          }
      }
     
  }
  double f=ans;
  f=(f+k)/2;
  
  cout<<fixed<<setprecision(12)<<f<<endl;
 
  
  
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define REP(i, n) for (int i{ 0 }; i < n; ++i)
#define REP2(i, s, n) for (int i{ s }; i < n; ++i)
#define DREP(i, n) for (int i{ n - 1 }; i <= 0; --i)
#define repa(arr) for (auto& e : arr)
#define DEB(x) (std::cerr << __LINE__ << ": x = " << x << std::endl)
#define DEBa(x) repa(x) DEB(e)

using namespace std;

int main() {
    string S;
    cin >> S;
    int cnt{ 0 };
    REP(i, 3) {
        if (S[i] == 'R') {
            if (i == 0 || cnt == 0 || S[i - 1] == 'R') cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 3576
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,c,d,mok;
	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&mok);
	mok*=4;
	b=min(b,a+a);
	c=min(c,b+b);
	d=min(d,c+c);
	ll ans=mok/8*d;
	mok%=8;
	if(mok&4)ans+=c;
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include <iostream>
 
using namespace std;
 
main(){
    int size, duration, actual;
    cin >> size >> duration;
    int total = 0;
    cin >> actual;
    int anterior = 0;
    for(int i=1;i<size;++i){
        cin >> actual;
        if(actual-anterior>duration){
            total+= duration;
        }
        else{
            total+= actual-anterior;
        }
        anterior = actual;
    }
    total+=duration;
    cout << total << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define per(i, a, b) for(int i = (a); i >= (b); i--)
using namespace std;
const int mod = 998244353;
const int M = 1000010, N = 200010;
int n, cnt[M], a[N];
int p[M], lp = 0, mu[M]; bool pri[M];
int sum[M], g[M], h[M], ans;

int ksm(int x, int y = mod - 2) {
	int w = 1; for(; y; y >>= 1, x = 1ll * x * x % mod) if(y & 1) w = 1ll * w * x % mod; return w;
}
void Sieve(const int &m) {
	mu[1] = 1;
	rep(i, 2, m) {
		if(!pri[i]) p[++lp] = i, mu[i] = mod - 1;
		for(int j = 1; p[j] * i <= m; j++) {
			pri[p[j] * i] = 1; if(i % p[j] == 0) break;
			if(mu[i]) mu[p[j] * i] = mod - mu[i];
		}
	}
}
int main() {
	Sieve(1000000);
	scanf("%d", &n); rep(i, 1, n) scanf("%d", &a[i]), ++cnt[a[i]];
	rep(i, 1, 1000000) {
		for(int j = i; j <= 1000000; j += i)
			g[i] = (g[i] + 1ll * cnt[j] * j % mod) % mod, h[i] = (h[i] + 1ll * j * cnt[j] % mod * j % mod) % mod;
	}
	rep(j, 1, 1000000) g[j] = (1ll * g[j] * g[j] % mod - h[j] + mod) % mod * (mod + 1) / 2 % mod;
	rep(i, 1, 1000000) {
		int inv = ksm(i), s = 0;
		rep(j, 1, 1000000 / i)
			s = (s + 1ll * mu[j] * g[j * i] % mod) % mod;
		ans = (ans + 1ll * s * inv % mod) % mod;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 21376
#include <iostream>
#include <vector>

using namespace std;

class DisjointSet {
    public:
        vector<int> rank, p;

        DisjointSet() {}
        DisjointSet(int size) {
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size; i++) makeSet(i);
        }

        void makeSet(int x) {
            p[x] = x;
            rank[x] = 0;
        }

        bool same (int x, int y) {
            return findSet(x) == findSet(y);
        }

        void unite(int x, int y) {
            link(findSet(x), findSet(y));
        }

        void link(int x, int y) {
            if (rank[x] > rank[y]) {
                p[y] = x;
            } else {
                p[x] = y;
                if (rank[x] == rank[y]) {
                    rank[y]++;
                }
            }
        }

        int findSet(int x) {
            while (p[x] != x) {
                x = p[x];
            }
            return p[x];
        }
};

int main(int argc, char const *argv[])
{
    int n, a, b, q;
    int t;

    cin >> n >> q;
    DisjointSet ds = DisjointSet(n);

    for (int i = 0; i < q; i++) {
        cin >> t >> a >> b;
        if (t == 0) { 
            ds.unite(a, b);
        } else if (t == 1) {
            if (ds.same(a, b)) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    double r;
    cin >> r;
    double pi = 3.1415926535;
    cout << 2 * pi * r << endl;
    
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9


int main(){
    string s;
    cin>>s;
    vvi p(26);
    rep(i,s.size()){
        int d=s[i]-'a';
        for(int j=0;j<p[d].size();j++){
            int l=i-p[d][j]+1;
            int c=p[d].size()-j+1;
            if(l<c*2){cout<<p[d][j]+1<<" "<<i+1<<endl;return 0;}
        }
        p[d].pb(i);
    }
    cout<<"-1 -1"<<endl;
	return 0;
}


Measured memory_bytes: 1144
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,a,b,p,m,x=0,y=0,z=0,i;
    vector<ll>v;
    cin>>n>>a>>b;
    for(i=0;i<n;i++)
    {
        cin>>m;
        v.push_back(m);
        if(m<=a)
            x++;
        else if(m>=a+1 && m<=b)
            y++;
        else if(m>=b+1)
            z++;
    }
    cout<<min(x,min(y,z))<<endl;
}


Measured memory_bytes: 256
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        
	        int H = sc.nextInt();
	        long[] a = new long[H];
	        for(int i=0;i<H;i++) {
	        	a[i] = sc.nextLong();
	        }
	        
	        Arrays.sort(a);
	        long ans = a[H-1];
	        int cnt=1;
	        for(int i=H-2;i>=0;i--) {
	        	if(cnt==H-1)break;
	        	ans=ans+a[i];
	        	cnt++;
	        	if(cnt==H-1)break;
	        	ans=ans+a[i];
	        	cnt++;
	        }
	        
	        System.out.println(ans);

		 }
	}

Measured memory_bytes: 61544
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<iomanip>
#include<cstring>
#include<string>
#include<set>

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

using namespace std;
using ll = long long int;

const ll INF = 1<<30;
const ll LINF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(void) {
    int l, r, d; cin >> l >> r >> d;
    int cnt = 0;
    for (int i = l; i <= r; i++) if (i % d == 0) cnt++;
    cout << cnt << endl;
}

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

int main() {
    string S;
    cin >> S;
    set<char> a;
    for (int i = 0; i < S.length(); i++)
    {
        a.insert(S[i]);
    }
    if (a.size() == S.length())
    {
        cout << "yes" << endl;
    } else
    {
        cout << "no" << endl;
    }
    
    
    
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lld long long
#define pb push_back
#define mk make_pair
#define MAX (lld)1e18+7
#define lim (lld)1e9+7
#define MAX2 (int)2e5+9
#define ff first
#define ss second
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

const lld mod=lim;

lld power(lld x, lld y, lld p)  
{   lld res = 1;     x = x % p; if (x == 0) return 0;  
  
    while (y > 0)  
    { if (y & 1) res = (res*x) % p;  y = y>>1; x = (x*x) % p;   }  
    return res;  } 


int extend_gcd(int a, int b, int& x, int& y) {
    if (b == 0) { x = 1;y = 0;return a;}
    int x1, y1;
    int d = extend_gcd(b, a % b, x1, y1);
    x = y1; y = x1 - y1 * (a / b);return d;	}

int rowNum[]={-1,0,0,1};
int colNum[]={0,-1,1,0};

int main()
{
	fastio
	string s;
	cin>>s;
	int cnt=0,mx=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='R')
			cnt++;
		else
		{
			mx=max(mx,cnt);
			cnt=0;
		}
	}

	mx=max(mx,cnt);

	cout<<mx<<endl;
}

Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line;
        while ((line = br.readLine()) != null && !line.isEmpty()) {
            for (int i = line.toCharArray().length - 1 ; 0 <= i ; i--) System.out.print(line.toCharArray()[i]);
            System.out.println();
        }
    }
}


Measured memory_bytes: 24160
#include <stdio.h>
#include <algorithm>
#include <complex>

int main()
{
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if (std::abs(c - a) <= d || (std::abs(c - b) <= d && std::abs(a - b) <= d))
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n;
  cin >> n;
  string s;
  cin >> s;

  vector<int> xs(n);
  for (int i = 0; i < n; i++) {
    xs[i] = s[i] - '1';
  }

  bool has_one = false;
  for (int i = 0; i < n; i++) {
    if (xs[i] == 1) {
      has_one = true;
    }
  }
  // cout << has_one << endl;
  if (!has_one) {
    for (int i = 0; i < n; i++) {
      xs[i] /= 2;
    }
    int r = 0;
    for (int i = 0; i < n; i++) {
     //  cout << (((n - 1) & i) == i) << endl;
      r += (((n - 1) & i) == i) * (xs[i] % 2);
      r %= 2;
    }
    cout << 2 * r << endl;
  } else {
    int r = 0;
    for (int i = 0; i < n; i++) {
      r += (((n - 1) & i) == i) * (xs[i] % 2);
      r %= 2;
    }
    cout << r << endl;
  }
}

Measured memory_bytes: 5276
#include<bits/stdc++.h>
using namespace std;
/*bool cmp(const node &x,const node &y){
	
}*/
int main(){
	int n,b,a;
	scanf("%d",&n);
	int ans=1,temp=1000000000,Min;
	cin>>Min;
    for(int i=1;i<n;++i){
    	cin>>a;
	    Min=min(Min,a);
	     if(a==Min){
	     	ans++;
		 }
    }
    cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  string S;
  cin>>N>>S;
  vector<int>sum(N+1);
  sum.at(0)=0;
  for(int i=1;i<N+1;i++){
    if(S.at(i-1)=='I'){
      sum.at(i)=sum.at(i-1)+1;
    }
    else{
      sum.at(i)=sum.at(i-1)-1;
    }
  }
  sort(sum.begin(),sum.end());
  cout<<sum.at(N)<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int a[21][21];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

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

    vector<ll> dp(1<<n);
    dp[0]=1;
    for(i=0; i<(1<<n); i++) {
        if(dp[i]==0) continue;
        int j;
        int cnt=0;
        for(j=0; j<n; j++) {
            if(i&(1<<j)) cnt++;
        }
        for(j=0; j<n; j++) {
            if(a[cnt][j] && !(i&(1<<j))) {
                dp[i|(1<<j)] = (dp[i|(1<<j)] + dp[i])%MOD;
            }
        }
    }

    printf("%lld\n", dp[(1<<n)-1]);

    return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define loop(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }
  

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

  char c=s[k-1];
  rep(i,n){
    if(s[i]!=c)cout << '*';
    else cout << c;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	long long a[50];
	int c, d;
	int k;
	int n, m;
	long long x, y, z;
	long long s,t;
	long long ans;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	x = 0;
	y = 10000000000000030;
	for (; x != y;){
		z = (x + y) / 2;
		k = 0;
		for (int i = 0; i < n; i++){
			t = (n*z) + i;
			s = 0;
			for (int j = 0; j < n; j++){
				s = ((a[j] + t + 1) / (n+1)) + s;
			}
			if (s <= t){
				k = 1;
				break;
			}
		}
		if (k == 1)y = z;
		else x = z + 1;
	}

	for (int i = 0; i < n; i++){
		t = (n*x) + i;
		s = 0;
		for (int j = 0; j < n; j++){
			s = ((a[j] + t + 1) / (n+1)) + s;
		}
		if (s <= t){
			ans = t;
			break;
		}
	}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 128
using System;
using System.Text.RegularExpressions;

namespace AtCoder {
  class Program {
    static void Main(string[] args) {
      string S = Console.ReadLine();
      Regex[] regexs = new Regex[] {
        new Regex(@"(.)\1(.)\2"),
        new Regex(@"(.)(.)\1\2"),
        new Regex(@"(.)(.)\2\1")
      };
      foreach(var regex in regexs) {
        Match match = regex.Match(S);
        if(match.Success && match.Groups[1].Value != match.Groups[2].Value){
          Console.WriteLine("Yes");
          return;
        }
      }
      Console.WriteLine("No");
    }
  }
}

Measured memory_bytes: 16224