akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long

vector<vector<ll>> combi(100001, vector<ll>(4,0));

void comb() {
	combi[1][0] = 1;
	combi[1][1] = 1;
	for (int i=2; i<100001; i++) {
		for (int j=0; j<4; j++) {
			if (j==0 or j==i)
				combi[i][j]=1;
			else
				combi[i][j] = combi[i-1][j] + combi[i-1][j-1];
		}
	}
}

int main() {
	comb();
	ll n; cin>>n;
	ll num = 0;
	map<char, int> names;
	for (int i=0; i<n; i++) {
		string s; cin>>s;
		switch (s[0]) {
			case 'M':
			case 'A':
			case 'R':
			case 'C':
			case 'H':
				names[s[0]]++;
				num++;
				break;
		}
	}

	ll ans = combi[num][3];
	for (pair<char, int> p : names) {
		if (p.second > 1) {
			ans -= combi[p.second][2] * (num-p.second);
			if (p.second > 2)
				ans -= combi[p.second][3];
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e;
    f = c*60+d-a*60-b;
    if(f-e >0 ){
        cout << f-e << endl;
    }else{
        cout << 0 << endl;
    }
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b){
        cout << c << endl;
        return 0;
    }
    if(b == c){
        cout << a << endl;
        return 0;
    }
    if(a == c){
        cout << b << endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <tuple>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(b - a == c - b){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>

using namespace std;


/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back


/*---  Type ---*/
typedef long long ll;


/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// 4-direction
int dy4[] = {0,  1, -1,  0};
int dx4[] = {1,  0,  0, -1};

// 8-direction
int dy8[] = {0,  1,  1,  1,  0, -1, -1, -1};
int dx8[] = {1,  1,  0, -1, -1, -1,  0,  1};

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

int main() {
  string s;
  cin >> s;
  cout << regex_replace(s, regex(","), " ") << endl;
  return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
mod = 10**9 + 7
l = [0]*(k+1)
ans = 0
for i in range(k,0,-1): #gcdがiの時を考える
    l[i] = pow(k//i,n,mod) #gcdがiである数列の個数
    for j in range(i*2,k+1,i): 
        l[i] -= l[j] #重複で数えている所を取り除く
    ans += i * l[i] 
print(ans%mod)

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

using namespace std;

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

    int sum=0;
    sum+=(b[a[0]-1]);
    //cout << b[a[0]-1] << endl;
    for(int i=1;i<n;i++)
    {
        sum+=(b[a[i]-1]);
        if(a[i-1]==(a[i]-1))
        {
            sum+=(c[a[i-1]-1]);
        }
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pb 	push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define mod 1000000007LL
#define F first
#define S second
#define speed ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
main()
{
   int n,m,i,j,k;
   cin>>n;
   vector<int> v(n);
   for(i=0;i<n;i++)
   	cin>>v[i];
   int f=0;
   v[0]--;
   for(i=1;i<n;i++)
   {
   	  if(v[i]-1<v[i-1])
   	  	;
   	  else
   	  	v[i]--;
   }
   if(is_sorted(all(v)))
   	cout<<"Yes";
   else
   	cout<<"No";
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

struct edge{
	int u, v, cost;
	edge(int u_, int v_, int cost_){
		u = u_; v = v_; cost = cost_;
	}
};
bool operator<(const edge &a, const edge &b){
	return a.cost < b.cost;
}


// Union-Find
struct union_find{
	vector<int> par, rank;
	
	// テ」ツつウテ」ツδウテ」ツつケテ」ツδ暗」ツδゥテ」ツつッテ」ツつソテ」ツ?ァテ・ツ按敕ヲツ慊淌・ツ個?
	union_find(int n){
		par = vector<int>( n );
		rank = vector<int>( n , 0 );
		for(int i=0 ; i < n ; i++ ){
			par[i] = i;
		}
	}
	// x テ」ツ?ョ root テ」ツつ津ィツソツ氾」ツ??
	int find(int x){
		return ( par[x] == x )? x : (par[x] = find(par[x]) ) ;
	}
	// x テ」ツ?ィ y テ」ツ?ョテ・ツアツ榲」ツ?凖」ツつ凝ゥツ崢?・ツ青暗」ツつ津、ツスツオテ・ツ青暗」ツ?凖」ツつ?
	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if( x == y ) return;
		
		if( rank[x] < rank[y] ){
			par[x] = y;
		}else{
			par[y] = x;
			if( rank[x] == rank[y] )
				rank[x]++;
		}
	}
	// x テ」ツ?ィ y テ」ツ?古・ツ青古」ツ?佚ゥツ崢?・ツ青暗」ツ?ォテ・ツアツ榲」ツ?凖」ツつ凝」ツ?凝」ツ?ゥテ」ツ??」ツ??
	bool same(int x, int y){
		return find(x) == find(y);
	}
	// テゥツ崢?・ツ青暗」ツ?ョテヲツ閉ーテ」ツつ津ィツソツ氾」ツ??
	int size(){
		set<int> s;
		for(int i=0 ; i < par.size() ; i++ ){
			s.insert( this->find(i) );
		}
		return s.size();
	}
};

typedef pair<int,int> P;
const int INF = 1e+8;
const int MAX_V = 101;
int N, M;

int connect(const vector<set<int> > &G, vector<edge> e = vector<edge>() ){
	union_find uf(N);
	for(int u=0 ; u < N ; u++ ){
		set<int> s = G[u];
		for(set<int>::iterator it = s.begin() ; it != s.end() ; ++it ){
			int v = *it;
			bool flag = true;
			for(int k=0 ; k < e.size() ; k++ ){
				if( e[k].u == u && e[k].v == v ) flag = false;
				if( e[k].u == v && e[k].v == u ) flag = false;
			}
			if( flag ) uf.unite(u, v);
		}
	}
	return uf.size();
}

int main(){

	// テ・ツ?・テ・ツ環?
	while( cin >> N >> M , N || M ){
		vector<set<int> > G(MAX_V);
		vector<edge> e;
		
		int ans = 0;
		for(int i=0 ; i < M ; i++ ){
			int x, y, c;
			cin >> x >> y >> c;
			
			if( c <= 0 ){ // テ」ツつウテ」ツつケテ」ツδ暗」ツ?古ィツイツ?」ツ?ョテ」ツつづ」ツ?ョテ」ツ?ッテ」ツ?凖」ツ?ケテ」ツ?ヲテ・ツ渉姪」ツつ甘ゥツ卍、テ」ツ??
				ans += c;
			}else{
				e.push_back( edge(x, y, c) );
				G[x].insert(y);
				G[y].insert(x);
			}
		}
		
		if( 2 <= connect(G) ){ // テゥツ?」テァツオツ静ヲツ按静・ツ按?」ツ??テ・ツ?凝、ツサツ・テ、ツクツ甘」ツ?ョテ」ツ?ィテ」ツ??
			cout << ans << endl;
		}else{ // テゥツ?」テァツオツ静ヲツ按静・ツ按?」ツ??テ・ツ?凝」ツ?ョテ」ツ?ィテ」ツ??
			bool flag = false;
			int sum_cost = ans;
			// テ」ツつィテ」ツδε」ツつクテ」ツつ津ゥツォツ佚」ツ??テ・ツ?凝・ツ渉姪」ツつ甘ゥツ卍、テ」ツ??」ツ?淌」ツ?ィテ」ツ?催」ツつ津・ツ?ィテゥツδィティツゥツヲテ」ツ??
			for(int i=0 ; i < e.size() ; i++ ){
				vector<edge> e_;
				e_.push_back( e[i] );
				
				if( 2 <= connect(G, e_) ){
					if( !flag ){
						flag = true;
						ans = sum_cost + e[i].cost;
					}else{
						ans = min(ans, sum_cost + e[i].cost);
					}
				}else{
					for(int j=i+1 ; j < e.size() ; j++ ){
						e_.push_back( e[j] );
						if( 2 <= connect(G, e_) ){
							if( !flag ){
								flag = true;
								ans = sum_cost + e[i].cost + e[j].cost;
							}else{
								ans = min(ans, sum_cost + e[i].cost + e[j].cost);
							}
						}
					}
				}
			}
			cout << ans << endl;
		}
	}
}

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

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

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

vector<int> dist;
vector<int> ans;
set<int> ok;
map<int, vector<int>> mp;


int main() {
  int n, m;
  cin >> n >> m;
  ans = vector<int>(n);
  rep (i, n) {
    ans[i] = INF;
  }

  rep (i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    mp[a].push_back(b);
    mp[b].push_back(a);
  }

  queue<int> q;
  rep (i, mp[0].size()) {
    ans[mp[0][i]] = 0;
    ok.insert(mp[0][i]);
    q.push(mp[0][i]);
  }

  while (!q.empty()) {
    int tmp = q.front();
    rep (i, mp[tmp].size()) {
      if (ok.find(mp[tmp][i]) == ok.end()) {
        // cout << tmp << " => " << mp[tmp][i] << endl;
        q.push(mp[tmp][i]);
        ok.insert(mp[tmp][i]);
        if (ans[mp[tmp][i]] == INF) ans[mp[tmp][i]] = tmp;
      }
    }
    q.pop();
  }

  for (int i = 1; i < n; i++) {
    if (ans[i] == INF) {
      No;
      return 0;
    }
  }

  Yes;
  for (int i = 1; i < n; i++) {
    P(ans[i] + 1);
  }


  return 0;
}

Measured memory_bytes: 20272
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
	int a, b, c;
	cin >> a >> b >> c;

	vector<int> v;
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);
	sort(v.begin(), v.end(), greater<int>());

	cout << (v[0] - v[1]) + (v[1] - v[2]) << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        int x = scanner.nextInt();
        int n = scanner.nextInt();

        if (n == 0) {
            System.out.println(x);
            System.exit(0);
        }

        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(scanner.nextInt());
        }
        Collections.sort(list);

        if (list.indexOf(x) < 0) {
            System.out.println(x);
            System.exit(0);
        }

        for (int diff = 1; diff <= 200; diff++) {
            //before
            int b = list.indexOf(x - diff);
            if (b < 0) {
                System.out.println(x - diff);
                System.exit(0);
            }
            //after
            int a = list.indexOf(x + diff);
            if (a < 0) {
                System.out.println(x + diff);
                System.exit(0);
            }
        }
        System.out.println(0);
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,t,s;
    cin>>n>>m;
    VV graph(m+10);
    rep(i,m){
        ll a,b;
        cin>>a>>b;
        graph[a].pb(b);
    }
    cin>>s>>t;

     //i頂点に、aけんぱ余りbで到達。
    VV d(n+1,Vec(3,INF));
    queue<tuple<ll,ll,ll>> q;

    //地点、けんぱすう、余り
    q.push(make_tuple(s,0,0));
    while (!q.empty()){
        tuple<ll,ll,ll> &tp = q.front();
        Vec &g = graph[get<0>(tp)];
        Each(child,g){
            if(d[child][(get<2>(tp)+1)%3] <= get<1>(tp)+(get<2>(tp)+1)/3){
                continue;
            }
            d[child][(get<2>(tp)+1)%3] =  get<1>(tp)+(get<2>(tp)+1)/3;
            //dbg(d);
            q.push(make_tuple(child,  get<1>(tp)+(get<2>(tp)+1)/3,   (get<2>(tp)+1)%3));
        }
        q.pop();
    }
    ll ans= d[t][0];
    if(ans==INF){
        cout<<-1<<endl;

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


Measured memory_bytes: 11264
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

int x[105];
int y[105];

int main(){
    //cin.tie(0);

    int K, S; cin >> K >> S;
    int ans = 0;
    for (int i = 0; i <= K; i++){
        for (int j = 0; j <= K; j++){
            if (S-i-j >= 0 && S-i-j <= K){
                ans++;
            }
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(); it!=c.end(); ++it)

// #defineの初利用にあたって参考にした http://peroon.hatenablog.com/entry/20091123/1258966199
// iteratorのforLoop                   http://bokko.hatenablog.com/entry/20090320/1237494217
// fastIO                              https://gist.github.com/rigibun/7905920

void solveAndOutput(map<int, long long> data, VI bangouList){
	bool flag = true;

	FOR(i, 0, bangouList.size()){
		if (data[bangouList[i]] >= 1000000){
			cout << bangouList[i] << endl;
			flag = false;
		}
	}
	if (flag)
		cout << "NA" << endl;
}

int main(){
	// sankou http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=97994#1

	long long n;
	// 重複なし、自動ソート
	map<int, long long> data;
	// 重複あり、ソートなし -> 重複するものは格納しないようにしたい.
	VI bangouList;
	fastIO;

	while (cin >> n, n){
		data.clear();
		bangouList.clear();
		while (n--){
			// int bangou = 0, tanka = 0, suu = 0;
			long long int bangou = 0, tanka = 0, suu = 0;
			cin >> bangou >> tanka >> suu;
			if(data[bangou] == 0)
				bangouList.push_back(bangou);
			// tankaとsuuがintだと、両方の値が大きいときにオーバーフローする
			data[bangou] += (tanka * suu);
		}
		solveAndOutput(data, bangouList);
	}
	return 0;
}

Measured memory_bytes: 1360
#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() {
  int n;ll k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  vector<int> s;
  vector<int> ord(n+1,-1);
  int c = 1, l = 0;
  {
    int v = 1;
    while (ord[v] == -1) {
      ord[v] = s.size();
      s.push_back(v);
      v = a[v-1];
    }
    c = s.size() - ord[v];
    l = ord[v];
  }

  if (k < l) cout << s[k] << endl;
  else {
    k -= l;
    k %= c;
    cout << s[l+k] << endl;
  }
  return 0;
}


Measured memory_bytes: 5844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


int main(){
    int a,b ;
    string s ;
    cin >> a >> b >> s ;
    bool ans = 1 ;
    int c ;
    for (int i = 0; i < a ; i++)
    {
        c = s.at(i) - '0' ;
        if (0 > c || 9 < c )
        {
            ans = 0 ;
        }
        
    }
    if (s.at(a) != '-')
    {
        ans = 0 ;
    }
    for (int i = 0; i < b; i++)
    {
        c = s.at(a+b-i) - '0' ;
        if (0 > c || 9 < c )
        {
            ans = 0 ;
        }
    }
    if (ans == 1)
    {
        cout << "Yes" << endl ;
    }else
    {
        cout << "No" << endl ;
    }
    
    
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll k, n;
    cin >> k >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) cin >> a[i];
    ll b[n+1];
    for(ll i = 0; i < n - 1; i++) b[i+1]=a[i+1]-a[i];
    b[n] =  k - a[n-1] + a[0];
    ll m=b[1];
    for(ll i = 1; i < n + 1; i++)
        if(m < b[i])
            m = b[i];
    ll ans = 0;
    for(ll i = 1;i <= n; i++)
        ans += b[i];
    cout << ans-m <<endl;
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <limits>
#include <type_traits>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

unsigned gcd(unsigned a, unsigned b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

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

	INT r = 1;
	auto t = s[0];
	INT d = 1;
	for (size_t i = 1; i < s.length(); i++)
	{
		if (s[i] != t)
		{
			d *= -1;
			t = s[i];
		}
		r += d;
	}
	cout << (s.length() - abs(r)) << endl;
	return 0;
}


Measured memory_bytes: 512
using System;

namespace Atc_0019
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();

            if (S.Substring(2, 1) == S.Substring(3, 1) && S.Substring(4, 1) == S.Substring(5, 1))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 25740
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int lli;

const lli p = 1000000007;

int main(int argc, char const *argv[]) {
  lli n, m;
  cin >> n >> m;
  lli dogs = 1, monkeys = 1, ans;
  if (abs(n-m)>=2) ans = 0;
  else {
    for (lli i = n; i > 0; i--) {
      dogs *= i;
      dogs %= p;
    }
    for (lli i = m; i > 0; i--) {
      monkeys *= i;
      monkeys %= p;
    }
    ans = dogs*monkeys;
  }
  if (n==m) ans *= 2;
  cout << ans % p << endl;
  return 0;
}


Measured memory_bytes: 256
A,B,C,X,Y=map(int,input().split())
if A+B>=2*C:
    if X>=Y:
        if A<=2*C:
            print(A*(X-Y)+2*C*Y)
        else:
            print(2*C*X)
    else:
        if B<=2*C:
            print(2*C*X+B*(Y-X))
        else:
            print(2*C*Y)
else:
    print(A*X+B*Y)

Measured memory_bytes: 3060
n = int(input())
s = input()
w = []
c = 0
for i in range(n):
  if s[i] == "W":
    c += 1
  w.append(c)
e = [i+1-w[i] for i in range(n)]
ans = e[-1]
for i in range(1,n):
  ans = min(ans, w[i-1]+e[-1]-e[i])
print(ans)

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

using ll = long long;

ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);

  ll r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  if (a < b) swap(a, b);
  return a * b / gcd(a, b);
}

int main() {
  ll A, B;
  scanf("%lld%lld", &A, &B);
  ll C, D;
  scanf("%lld%lld", &C, &D);

  ll range = B - A + 1;
  ll A_C_quotient = (A - 1) / C;
  ll A_D_quotient = (A - 1) / D;
  ll A_CD_quotient = (A - 1) / lcm(C, D);
  ll B_C_quotient = B / C;
  ll B_D_quotient = B / D;
  ll B_CD_quotient = B / lcm(C, D);

  ll ans = range - ((B_C_quotient + B_D_quotient - B_CD_quotient) -
           (A_C_quotient + A_D_quotient - A_CD_quotient));
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

bool compare (ll a, ll b)
{
    return a>b;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    ll n;
    cin >> n;
    ll arr[n];
    for (ll i=0;i<=n-1;i++)
    {
        cin >> arr[i];
    }

    sort(arr,arr+n,compare);
    if (n==2)
    {
        cout << arr[0] << endl;
    }
    else
    {
        ll out_val=(n-2)/2;
        ll sum=arr[0];
        for (ll i=0;i<=out_val-1;i++)
        {
            sum=sum+(arr[i+1]*2);
        }
        if (n%2==1)
        {
            sum=sum+arr[out_val+1];
        }
        cout << sum << endl;
    }

    return 0;
}

Measured memory_bytes: 5148
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {

	static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws Exception {

		// --- input ---
		int[] l1 = getNums(in.readLine().split(" "), 2);
		int[] vals = getNums(in.readLine().split(" "), l1[0]);
		in.close();

		// --- resolv ---
		HashMap<Integer, Integer> map = new HashMap<>();
		for(int v : vals) {
			if(map.containsKey(v)) {
				map.put(v, map.get(v) + 1);
			} else {
				map.put(v, 1);
			}
		}

		Object[] ary = map.values().stream().sorted((a, b) -> b - a).toArray();

		int ans = 0;
		for(int i=0; i < ary.length; i++) {
			if(i < l1[1]) {
				continue;
			}
			ans += (int)ary[i];
		}

		System.out.println(ans);
	}

	public static int[] getNums(String[] vals, int num) {
		int[] vAry = new int[num];
		for(int i=0; i < num; i++) {
			vAry[i] = Integer.parseInt(vals[i]);
		}
		return vAry;
	}
}

Measured memory_bytes: 52320
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
//using namespace atcoder;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<int> > Graph;
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; }
const ll INF = numeric_limits<ll>::max();


#define debug(v) cout<<#v<<": ",prt(v);
template <typename A,typename B>
inline void prt(pair<A,B> p){cout<<"("<<p.first<<", "<<p.second<<")\n";}
template <typename A,typename B,typename C>
inline void prt(tuple<A,B,C> p){cout<<"("<<get<0>(p)<<", "<<get<1>(p)<<", "<<get<2>(p)<<")\n";}
inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';}
template <typename T> 
inline void prt(vector<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(deque<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(unordered_map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(set<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(multiset<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}

ll n;
vector<ll>a;

ll dp[100];


int main(){
    cin >> n;
    a.resize(n+1);
    rep(i,n)cin>>a[i+1];
    dp[0]=1000;
    for(int i=1;i<=n;i++){
        chmax(dp[i],dp[i-1]);
        for(int j=0;j<i-1;j++){
            chmax(dp[i],dp[j]/a[j+1]*a[i]+(dp[j]-dp[j]/a[j+1]*a[j+1]));
        }
    }
    cout << dp[n] << endl;

    return 0;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
const int mod = 1000000007;


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

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

int dp[100100];
int main() {
  int n,m;
  cin>>n>>m;
  vl out(n+1,0);

  rep(i,m){
    int a;
    cin>>a;
    out[a]=1;
  }
  rep(i,n-1){
    if(out[i] && out[i+1]){
      cout<<0<<endl;
      return 0;
    }
  }
  dp[0] = 1;
  rep(i,n){
    if(!out[i+1])dp[i+1]+=dp[i];
    if(!out[i+2])dp[i+2]+=dp[i];
    dp[i+1]%=mod;
    dp[i+2]%=mod;
  }
  print(dp[n]);

  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(80);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll a;
    ld b;
    cin >> a >> b;
    cout << (ll)(a * b) << endl;
}

Measured memory_bytes: 3744
n, x = map(int, input().split())

l = [0] * (n + 1)
p = [0] * (n + 1)
l[0] = 1
p[0] = 1
for i in range(n):
    l[i+1] = l[i]*2+3
    p[i+1] = p[i]*2+1

ans = 0
for i in range(n, -1, -1):
    layer = l[i]
    if x >= layer:
        ans += p[i]
        break
    elif x <= 1:
        break

    half = l[i - 1] + 1
    if x > half:
        ans += 1
        ans += p[i - 1]
        x -= half
        x -= 1
    elif x <= half:
        x -= 1

print(ans)


Measured memory_bytes: 3064
from collections import Counter

N=int(input())
A=list(map(int,input().split()))

a=list(set(A))
C=Counter(A)
total=0

for i in range(len(a)):
  total+=C[a[i]]*(C[a[i]]-1)//2

for i in range(N):
  print(total-C[A[i]]+1)

Measured memory_bytes: 27164
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


int main(void){
    ll N,K;
    cin>>N>>K;
    vector<ll> A(K);
    rep(i,K) cin>>A.at(i);
    N--;
    
    bool OK=false;
    while(!OK){
        OK=true;
        N++;
        rep(i,K) if(N%10==A.at(i)) OK=false;
        if(N<10) continue;
        rep(i,K) if((N%100)/10==A.at(i)) OK=false;
        if(N<100) continue;
        rep(i,K) if((N%1000)/100==A.at(i)) OK=false;
        if(N<1000) continue;
        rep(i,K) if((N%10000)/1000==A.at(i)) OK=false;
        if(N<10000) continue;
        rep(i,K) if((N%100000)/10000==A.at(i)) OK=false;
    }
    cout<<N<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n, m, k, a[200005], suma[200005], b[200005], sumb[200005], ans;
long long bins(int l, int r, long long val){
//	cout << l << "  " << r << endl;
	if (l==r) return l;
	int mid=(l+r+1)/2;
	if (sumb[mid]>val) return bins(l, mid-1, val);
	else return bins(mid, r, val);
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m >> k;
for (int i=1; i<=n; i++) cin >> a[i];
for (int i=1; i<=n; i++) suma[i]=suma[i-1]+a[i];
for (int i=1; i<=m; i++) cin >> b[i];
for (int i=1; i<=m; i++) sumb[i]=sumb[i-1]+b[i];
for (int i=0; i<=n; i++){
	if (suma[i]<=k){
		ans = max(ans, i+bins(0, m, k-suma[i]));
	}
} cout << ans;
return 0;
}


Measured memory_bytes: 9868
fun main(args: Array<String>) {
    val (K, A, B) = readLine()!!.split(" ").map { it.toLong() }
    if (B - A <= 2 || K - (A - 1) < 2) {
        println(K + 1)
    } else {
        val x = K - (A - 1)
        println(A + (B - A) * (x / 2) + (x % 2))
    }
}

Measured memory_bytes: 37936
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1234567;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<int>B(N-1);
    for(int i = 0; i < N-1; i++) {
        cin >> B[i];
    }
    int ans = B[0]+B[N-2];
    for(int i = 1; i < N-1; i++) {
        ans+=min(B[i],B[i-1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3592
n = gets.to_i

ss = {}

ss['AC'] = 0
ss['WA'] = 0
ss['TLE'] = 0
ss['RE'] = 0

n.times{
	s = gets.chomp
	ss[s] += 1
}

puts "AC x #{ss['AC']}"
puts "WA x #{ss['WA']}"
puts "TLE x #{ss['TLE']}"
puts "RE x #{ss['RE']}"


Measured memory_bytes: 14336
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;


int main() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, 0, n) cin >> a[i];
	sort(a.begin(),a.end());
	double max = a[n - 1], absmax = 0;;
	rep(i, 0, n - 1) {
		if (abs(absmax - max / 2) > abs(a[i] - max / 2)) absmax = a[i];
	}cout << (int)max << " "<<(int)absmax << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iterator>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(v) begin(v), end(v)
#define rreps(i, a, n) for (ll i = (a); i <= (ll)(n); ++i)
#define rrep(i, n) rreps(i, 0, n)
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define each(i, n) for (auto&& i : n)
#define fill(x, y) memset(x,y,sizeof(x))
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
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; }
template <typename T> inline void print(const T& x) {cout << x << '\n';}

signed main()
{ 
  int n; cin>>n;
  vi ans;
  rep(i,n)
  {
    int y,m,d; cin>>y>>m>>d;
    int sum=0;
    sum+=(y-1)%3*195;  
    sum+=(y-1)/3*590;
    sum+=(m-1)%2*20;
    if(y%3==0) sum+=(m-1)/2*40;
    else sum+=(m-1)/2*39;
    sum+=d;
    sum=999/3*590+1-sum;
    ans.pb(sum);
  }
  each(v,ans) print(v);

  return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
 using namespace std;
 int main(){
 	string s;
 	cin>>s;
 	for(int i=0;i<4;i++){
 		if(s[3]=='7')
 			s[3]='8';
 	}
 	cout<<s<<"\n";
 	return 0;
 }

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        int x = inp.nextInt();
        int a = inp.nextInt();
        int b = inp.nextInt();
        inp.close();
        x -= a;
        int p = (int)Math.floor(x / b);
        System.out.println(x - b * p);
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>

using namespace std;

int main(void){
	int n;
	bool first = true;
	
	while(cin >> n){
		int d[5];
		
		for(int i=4;i>=0;i--){
			d[4-i] = (int)(n / pow(10, i)) % 10;
		}
		
		if(!first) cout << endl;
		
		for(int i=0;i<8;i++){
			for(int j=0;j<5;j++){
				if(i == 0){
					if(d[j] / 5 == 0){
						cout << "*";
					}else{
						cout << " ";
					}
				}else if(i == 1){
					if(d[j] / 5 == 1){
						cout << "*";
					}else{
						cout << " ";
					}
				}else if(i == 2){
					cout << "=";
				}else if(i == 3){
					if(d[j] % 5 == 0){
						cout << " ";
					}else{
						cout << "*";
					}
				}else if(i == 4){
					if(d[j] % 5 == 1){
						cout << " ";
					}else{
						cout << "*";
					}
				}else if(i == 5){
					if(d[j] % 5 == 2){
						cout << " ";
					}else{
						cout << "*";
					}
				}else if(i == 6){
					if(d[j] % 5 == 3){
						cout << " ";
					}else{
						cout << "*";
					}
				}else if(i == 7){
					if(d[j] % 5 == 4){
						cout << " ";
					}else{
						cout << "*";
					}
				}
			}
			cout << endl;
			first = false;
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const int mod = 2019;
static const int INF = 3000;
using namespace std;

int main(){
	int n;
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;++i)sum+=i;
	cout<<sum<<endl;
}


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

int N;
vector<vector<int> > A(3, vector<int>(3));
int B;
int main(){
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            /* code */
            cin >> A.at(i).at(j);
        }
    }
    cin >> N;

    for (int b = 0; b < N; b++)
    {
        /* code */
        cin >> B;
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (A.at(i).at(j) == B)
                {
                    A.at(i).at(j) = 0;
                }
                
            }
        }
    }

    // for (int i = 0; i < 3; i++)
    // {
    //     for (int j = 0; j < 3; j++)
    //     {
    //         cout << A.at(i).at(j) << endl;
    //     }
    // }

    // int x = 0;
    for (int i = 0; i < 3; i++)
    {
        if (A.at(i).at(0) == A.at(i).at(1) &&  A.at(i).at(0) == A.at(i).at(2))
        {
            printf("%s", "Yes");
            return 0;
        }
        else if (A.at(0).at(i) == A.at(1).at(i) && A.at(0).at(i) ==  A.at(2).at(i))
        {
            printf("%s", "Yes");
            return 0;
        }
    }

    if (A.at(0).at(0) == A.at(1).at(1) && A.at(0).at(0) == A.at(2).at(2))
    {
        printf("%s", "Yes");
        return 0;
    }
    else if (A.at(0).at(2) == A.at(1).at(1) && A.at(0).at(2) == A.at(2).at(0))
    {
        printf("%s", "Yes");
        return 0;
    }
    else{
        printf("%s", "No");
        return 0;
    }


}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
int main(){
    int n,r;
    cin >> n >> r;
    if(n >= 10){
        cout << r << endl;
        return 0;
    }
    cout << r + (100 * (10 - n)) << endl;
    return 0;
}

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

int main(void) {
  vector<int> vec;
  while(1) {
    int num;
    cin >> num;
    if(num != 0) {
      vec.push_back(num);
    } else {
      break;
    }
  }

  for(int i = 0; i < vec.size(); i++) {
    cout << "Case " << i+1 << ": " << vec[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3112
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, modinv, bitSearch, bitList, dfs, bfs, dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color; vll path; vl D; ll C;
//***********//
int main() {
	ll A, B;
	cin >> A >> B;
	if (B == 1) {
		cout << 20 << " " << 100 << endl;
	}
	else {
		cout << 41 << " " << 100 << endl;
	}
	
	if (B > 1) {
		A--;
		for (i = 0; i < 21; i++) {
			for (j = 0; j < 100; j++) {
				if (i % 2 == 0 || j % 2 == 0 || B <= 1)cout << '.';
				else {
					cout << '#';
					B--;
				}
			}
			cout << endl;
		}
	}
	if (true) {
		B--;
		for (i = 0; i < 20; i++) {
			for (j = 0; j < 100; j++) {
				if (i % 2 == 0 || j % 2 == 0 || A == 0)cout << '#';
				else {
					cout << '.';
					A--;
				}
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split(' ')))
b = [0] * n
K = [0] * n
for i in range(n):
    if i % 2 == 0: K[i] = i
    else: K[i] = -1 * (i + 1)

if n % 2 == 0:
    for i in range(n):
        b[(n+K[i])//2] = a[i]
else:
    for i in range(n):
        b[(n-K[i]-1)//2] = a[i]

print(' '.join(map(str, b)))

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 24;

constexpr int kMaxXY = 1e5 + 1;
constexpr int kN = 1e5 * 4;

int memox[kMaxXY];
int memoy[kMaxXY];
int p[kN];

int root(int idx){
    if(p[idx] == idx) return idx;

    return p[idx] = root(p[idx]);
}

int main(void){
    for(int n, w, h; cin >> n >> w >> h;){
        int numIdx = 0;
        vi cnt(n);

        // x = 0, x = w - 1, y = 0, y = h - 1
        vvi cntSumi(n, vi(4));

        fill(memox, memox + kMaxXY, -1);
        fill(memoy, memoy + kMaxXY, -1);

        rep(loop, n){
            int x, y; cin >> x >> y; x--, y--;
            int idx; //root
            
            if(memox[x] != -1 && memoy[y] != -1){
                idx = root(memox[x]);

                if(root(memox[x]) != root(memoy[y])){
                    //union r2 -> r1(new root)
                    int r1 = idx, r2 = root(memoy[y]);

                    cnt[r1] += cnt[r2]; cnt[r2] = 0;
                    rep(i, 4) cntSumi[r1][i] += cntSumi[r2][i], cntSumi[r2][i] = 0;

                    p[r2] = idx;
                }
            }
            else if(memox[x] != -1){
                idx = memoy[y] = root(memox[x]);
            }
            else if(memoy[y] != -1){
                idx = memox[x] = root(memoy[y]);
            }
            else {
                p[numIdx] = numIdx;
                idx = memox[x] = memoy[y] = numIdx++;
            }

            if(x ==   0) cntSumi[idx][0]++;
            if(x == w-1) cntSumi[idx][1]++;
            if(y ==   0) cntSumi[idx][2]++;
            if(y == h-1) cntSumi[idx][3]++;

            cnt[idx]++;
        }

        int res = 0, numS = 0;
        vi numSumi(4);
        rep(i, numIdx){
            if(cnt[i] != 0) res += cnt[i] - 1, numS++;

            rep(j, 4){
                if(cntSumi[i][j] != 0){
                    numSumi[j]++;
                }
            }
        }
        if(numS != 1) res += (numS - *max_element(all(numSumi))) + numS - 1;

        cout << res << endl;
    }

	return 0;
}

Measured memory_bytes: 4428
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll w[105], v[105];
ll dp[105][100005];
int main() {
  int n, W;
  cin >> n >> W;
  for (int i = 1; i <= n; i++)
    cin >> w[i] >> v[i];
  for (int i = 1; i <= n; i++) {

    for (int j = 0; j <= W; j++) {
      if (j - w[i] < 0)
        dp[i + 1][j] = dp[i][j];
      else
        dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
    }
  }
  ll ans = 0;
  for (int i = 0; i <= W; i++)
    ans = max(ans, dp[n + 1][i]);
  cout << ans << endl;
}

Measured memory_bytes: 78592
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll              long long 
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
const ll N=4500+1;
const ll inf=1e17;
ll dp[N];
ll n,m;
ll lmt;
vector<ll>p;
vector<ll>b;
 
ll Set(ll N,ll pos){return N=N | (1<<pos);}
ll reset(ll N,ll pos){return N= N & ~(1<<pos);}
bool check(ll N,ll pos){return (bool)(N & (1<<pos));}
 
int main()
{
    IOS
    cin>>n>>m;
    lmt=(1<<n);     
    for(ll i=0;i<N;i++)
    {
        dp[i]=inf;     
    }
    for(ll i=0;i<m;i++)
    {
        ll t,cst;
        cin>>cst>>t;
        ll val=0;
        while(t--)
        {
            ll x;
            cin>>x;
            val=Set(val,x-1);
        }
        p.pb(val);          
        b.pb(cst);
        dp[val]=min(dp[val],cst);
    }
    for(ll i=0;i<m;i++)
    {
        for(ll j=0;j<lmt;j++)
        {        
            dp[j|p[i]]=min(dp[j|p[i]],b[i]+dp[j]);
        }
    }           
    if(dp[lmt-1]!=inf)
    cout<<dp[lmt-1]<<endl;
    else
    cout<<-1<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
 #include<iostream>
using namespace std;
long long  a[200005];
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	unsigned long long h,k=1,sum=0;
	cin>>h;
	while(h>0)
	{
		h=h/2;
		sum=sum+k;
		k=k*2;
	}
	
	
	

	cout<<sum;
	
	
	
 } 

Measured memory_bytes: 256
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize,
    p: [usize; n]
    }
    let ans: usize = p.iter().sum::<usize>() - p.iter().max().unwrap() / 2;
    println!("{}", ans);
}


Measured memory_bytes: 2112