akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;

    cin >> s;

    map<char, long> table;
    map<char, long>::iterator it;
    string pre = "";
    string post = "";
    long n, m = 0L;
    bool isOne = false;
    long ans = 0L;

    long i, j, len = s.size();

    table['x'] = 0L;

    for (i = 0; i < len; i++) table[s[i]]++;

    for (it = table.begin(); it != table.end(); it++) {
        if (it->first != 'x') {
            if (!isOne && it->second %2L == 1L) {
                isOne = true;
            } else if (isOne && it->second % 2L == 1L) {
                cout << -1 << '\n';

                return 0;
            } else if (it->second % 2L != 0L) {
                cout << -1 << '\n';

                return 0;
            }

            n += it->second;
        }
    }

    for (i = 0; i < len; i++) {
        if (s[i] != 'x') {
            pre += s.substr(i, 1);
            m++;

            if (n / 2L <= m) break;
        }
    }

    m = 0L;
    for (i = len - 1; 0 <= i; i--) {
        if (s[i] != 'x') {
            post += s.substr(i, 1);
            m++;

            if (n / 2L <= m) break;
        }
    }

    if (pre == post) {
        j = len - 1;
        for (i = 0; i < j; i++, j--) {
            if (s[i] != s[j] && (s[i] == 'x' || s[j] == 'x')) {
                ans++;

                if (s[j] == 'x') s.insert(i, "x");
                else if (s[i] == 'x') s.insert(j + 1, "x");

                j++;
            }
        }

        cout << ans << '\n';
    } else {
        cout << -1 << '\n';
    }

    return 0;
}


Measured memory_bytes: 720
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
vector<ll>dist(200001);
void bfs(ll k,vector<vector<ll>>&g){
  queue<P> q;
  ll n=g.size();
  q.emplace(k,0);
  fill(dist.begin(),dist.begin()+n,INF);
  while(!q.empty()){
    ll x=q.front().fi;
    ll len=q.front().se;
    if(dist[x]==INF){
      dist[x]=len;
      for(ll i=0;i<g[x].size();i++){
        q.emplace(g[x][i],len+1);
      }
    }
    q.pop();
  }
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,m;cin>>n>>m;
  vector<vector<ll>>g(n);
  rep(i,0,m){
    ll u,v;cin>>u>>v;u--;v--;
    g[u].PB(v);
    g[v].PB(u);
  }
  bfs(0,g);
  cout<<"Yes"<<endl;
  //debug(dist,n);
  rep(i,1,n){
    for(auto to:g[i]){
      if(dist[to]+1==dist[i]){
        cout<<to+1<<endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 17840
#include <iostream>
using namespace std;
int main() {
  int N;
  bool O = true;
  cin >> N;
  while (N>0) {
    int A;
    cin >> A;
    if (A % 2 == 0 && A % 3 != 0 && A % 5 != 0) {
         O = false;
         break;
       }
       N--;
      }
  if (O) cout << "APPROVED" <<endl;
  else cout << "DENIED" <<endl;
 }



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

int main() {
	string str;
	while (cin >> str && str != "-") {

		int m;
		cin >> m;
		for (int i = 0; i < m; ++i) {
			int h;
			cin >> h;
			h = str.size() - h;
			string temp = "";
			for (int j = str.size() - h; j < str.size(); ++j) {
				temp += str[j];
			}
			for (int j = str.size() - 1; j >= 0 + h; --j) {
				str[j] = str[j - h];
			}
			for (int j = 0; j < temp.size(); ++j) {
				str[j] = temp[j];
			}
		}
		cout << str << endl;
	}

	return 0;
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;


int main(){
    int A;
    cin >> A;
    if(A == 3 || A == 5 || A == 7 ){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
r, c = [int(i) for i in input().split()]

data = []
sum_row = [0] * (c + 1)

for ri in range(r):
    data.append([int(i) for i in input().split()])
    data[ri].append(sum(data[ri]))
    print(" ".join([str(d) for d in data[ri]]))
    for ci in range(c + 1):
        sum_row[ci] += data[ri][ci]
        
print(" ".join([str(s) for s in sum_row]))

Measured memory_bytes: 7744
#include <stdio.h>
int main()
{
	int H, W, i, j, n;
	while(1){
		scanf("%d %d", &H, &W);
		if(H==0 && W==0){
			break;
		} else {
			for(i=0; i<H; i++){
				for(j=0; j<W; j++){
					printf("#");
					}
				printf("\n");
				}
				printf("\n");
			}
	}
	return 0;
}

Measured memory_bytes: 572
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] hw = Console.ReadLine().Split(' ');
		int h = int.Parse(hw[0]);
		int w = int.Parse(hw[1]);
		
		char[,] A = new char[h,w];
		for (int i=0;i<h;i++){
		    string input = Console.ReadLine();
		    for(int j=0;j<w;j++){
		        A[i,j] = input.Substring(j,1)[0];
		    }
		}
		int ans = 0;
		//全探索
		for(int i=0;i<h;i++){
		    for(int j=0;j<w;j++){
		        //A[i,j]が道だったらそこをスタートとして、幅優先探索開始
		        if(A[i,j] == '.'){
		            //経路数保存用の迷路作成
		            int[,] B = new int[h,w];
		            //全要素-1で初期化
		            for(int i1=0;i1<h;i1++){
		                for(int j1=0;j1<w;j1++){
		                    B[i1,j1] = -1;
		                }
		            }
		            //Sを0に
		            B[i,j] = 0;
		            //隣接するマス番号を入れるqueueを作成
		            List<int> q = new List<int>();
		            q.Add(i*w + j);
		            //隣接するマスがなくなるまでループ
		            while(q.Count() > 0){
		                List<int> q2 = new List<int>(q);
		                q.Clear();
		                //隣接するマスが進行可能ならキューに入れてBに経路数を代入
		                for(int k=0;k<q2.Count();k++){
		                    //始点のi,j
		                    int i2 = q2[k]/w;
		                    int j2 = q2[k]%w;
		                    //Console.WriteLine("q2[k]:"+q2[k]+",i2:"+i2+",j2:"+j2);
		                    //上
		                    if(i2-1>=0 && A[i2-1,j2] == '.' && B[i2-1,j2] == -1){
		                        B[i2-1,j2] = B[i2,j2] + 1;
		                        q.Add((i2-1)*w + j2);
		                    }
		                    //下
		                    if(i2+1<h && A[i2+1,j2] == '.' && B[i2+1,j2] == -1){
		                        B[i2+1,j2] = B[i2,j2] + 1;
		                        q.Add((i2+1)*w + j2);
		                    }
		                    //左
		                    if(j2-1>=0 && A[i2,j2-1] == '.' && B[i2,j2-1] == -1){
		                        B[i2,j2-1] = B[i2,j2] + 1;
		                        q.Add(i2*w + j2 - 1);
		                    }
		                    //右
		                    if(j2+1<w && A[i2,j2+1] == '.' && B[i2,j2+1] == -1){
		                        B[i2,j2+1] = B[i2,j2] + 1;
		                        q.Add(i2*w + j2 + 1);
		                    }
		                }
		            }
		            //A[i,j]をSとしたときの全マスへの最短経路がBに入っているのでその最大値を仮の答えにする
		            int max = 0;
		            for(int i3=0;i3<h;i3++){
		                for(int j3=0;j3<w;j3++){
		                    max = Math.Max(B[i3,j3],max);
		                }
		            }
		            ans = Math.Max(ans,max);
		            
		        }
		    }
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int f(int x, int y, int z){
   return x*x+y*y+z*z+x*y+y*z+z*x;
}
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n; cin >> n;
   vector<int> ans(n+1,0);
   for (int x = 1; x < 100; x++){
      for (int y = 1; y < 100; y++){
         for (int z = 1; z < 100; z++){
            if (f(x,y,z)<=n){
               ans[f(x,y,z)]++;
            }
         }
      }
   }
   rep(i,n)cout << ans[i+1] << endl;
   
}

Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
using namespace std;
typedef long long unsigned int llui_t;
typedef long long int lli_t;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

/* inputs */
llui_t N;

int main() {
    cin >> N;

    vector<llui_t> A1(N);
    vector<llui_t> A2(N);

	for(llui_t i=0; i<N; i++) {
		cin >> A1[i];
        if(i!=0) {
            A1[i] += A1[i-1];
        }
	}
	for(llui_t i=0; i<N; i++) {
		cin >> A2[i];
        if(i!=0) {
            A2[i] += A2[i-1];
        }
	}

	llui_t ans = 0;
	for(llui_t i=0; i<N; i++) {
        llui_t a = A1[i] + A2[N-1];
        if(i!=0) {
            a -= A2[i-1];
        }
		ans = max(ans, a);
	}

	cout << ans << endl;
}


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

int str_add(char a[], char b[], char ans[]);

int main(void){
        int n, i, j, judge_overflow;
        char num1[1000], num2[1000];
        char ans[1000];


        scanf("%d" , &n);

        for(i = 0; i < n; i++){
              
               for(j = 0; j < 1000; j++){
                      num1[j] = num2[j]  = ans[j] = '\0';
               }

               scanf("%s %s" , num1, num2);

               judge_overflow = str_add(num1, num2, ans);

			   if(judge_overflow == -1){
				   printf("overflow\n");
			   }else if(judge_overflow == 0){
				   printf("%s\n", ans);
			   }	 
        }

        return 0;
}

int str_add(char a[], char b[], char ans[]){

	int i, j, t;
	int len1,len2, len_ans;
	int loop1, loop2;
	int end_ans;
	char *pstr1, *pstr2, *pstr_ans;

	len1 = strlen(a);
	len2 = strlen(b);

	if(len1 > 80 || len2 > 80){
		return -1;
	}

	if(len1>=len2){
		pstr1 = a+(len1-1);
		pstr2 = b+(len2-1);
		loop1 = len2;
		loop2 = len1 - len2;
		end_ans = len1;
	}else{
		pstr1 = b+(len2-1);
		pstr2 = a+(len1-1);
		loop1 = len1;
		loop2 = len2 - len1;
		end_ans = len2;
	}
	
	t = 0;

	for(i = 0; i < loop1; i++){
		*(ans+(end_ans-1)-i) = '0' + (((*(pstr1-i) -'0') +(*(pstr2-i)-'0')) + t) % 10;
		if(((*(pstr1-i)-'0'+*(pstr2-i)-'0')+t)/10){
			t = 1;
		}else{
			t = 0;
		}
	}
	
	for(j = 0; j < loop2; j++){
			if(t == 1){
				*(ans+(end_ans-1)-i-j) = '0' + (((*(pstr1-i-j) - '0' )+ t) % 10);
				if(((*(pstr1-i-j) + t)/10)){
					t = 1;
				}else{
					t = 0;
				}
			}else{
			*(ans+(end_ans-1)-i-j) = *(pstr1-i-j);
		}
	}
	

	if(t == 1){
		len_ans = strlen(ans);
		pstr_ans = ans + len_ans;
		

		for(i = 0 ; i <=len_ans; i++){
			*((pstr_ans +1)- i) = *(pstr_ans - i);
		}

		*((pstr_ans+1)- i) = '1';
	}else{
		*(ans+(end_ans-1)-i-j) = *(pstr1-i-j);
	}

	if(strlen(ans) > 80){
		return -1;
	}
	
	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const ll N   = 500500;

int main()
{
	fio
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n , i, j, k;
	cin >> n;
	ll ans =  0;
	for (i = 1; i <= n - 1; i++)
	{
		ans+= (n-1)/i;
	}
	cout << ans << "\n";
	return 0;

}

Measured memory_bytes: 3640
#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 MAX=100005;
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 a,p;
    cin>>a>>p;
    ll ans = 0;
    ans = (3*a+p)/2;
    cout<<ans<<endl;
    return  0;
}


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	auto count = 0;
	for (auto i = a; i <= b ; i++) {
		if (c % i == 0) {
			count ++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
const ll INF = 1LL << 61;
const ll MOD = 1000000007 /*988244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, m, n, t, r, k, w, l, ans, i, j;
string S, T;
vl A, B;
vl g[MAX_N];
vl visited(MAX_N, 0), used(MAX_N, 0);
vl D(MAX_N);
void solve() {
    rep(i, n) {
        rep(j, n - 1) {
            g[i * n + j].pb(i * n + j + 1);
            g[i * n + j + 1].pb(i * n + j);
            g[(j + 1) * n + i].pb(j * n + i);
            g[j * n + i].pb((j + 1) * n + i);
        }
    }

    rep(i, n) {
        rep(j, n) { D[i * n + j] = min({i, n - 1 - i, j, n - 1 - j}); }
    }

    rep(i, n * n) {
        x = A[i];
        // cout << x << endl;
        used[x] = 1;
        p = 0;
        queue<ll> Q;
        Q.push(x);
        vl K;
        visited[x] = 1;
        K.pb(x);
        while(!Q.empty()) {
            int v = Q.front();
            Q.pop();
            for(ll x : g[v]) {
                if(visited[x] == 0 && D[x] > D[v] + 1 && used[v] == 0) {
                    visited[x] = 1;
                    K.pb(x);
                    Q.push(x);
                    D[x] = D[v] + 1;
                }
                if(visited[x] == 0 && D[x] > D[v] && used[v] == 1) {
                    visited[x] = 1;
                    Q.push(x);
                    K.pb(x);
                    D[x] = D[v];
                }
            }
        }

        for(ll i : K)
            visited[i]--;

        /*rep(j, n) {
            rep(k, n) { cout << D[j * n + k]; }
            cout << " ";
            rep(k, n) { cout << used[j * n + k]; }
            cout << endl;
        }*/

        ans += D[x];

        // cout << endl;
    }

    cout << ans << endl;
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n * n) {
        cin >> a;
        a--;
        A.pb(a);
    }
    solve();
}


Measured memory_bytes: 31672
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = a; i < n; i++)
#define Repr(i, n, a) for (int i = n; i >= a; i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int ans = 0;
    rep(i, 100)
    {
        bool f = true;
        rep(j, n)
        {
            if (h[j] != 0)
            {
                if (f)
                {
                    f = false;
                    ans++;
                }
                h[j]--;
            }
            else
                f = true;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    string str;
    cin >> str;
    int ans = 0;
    
    for(char s : str){
        if(ans == 0 && s == 'C'){
            ans++;
        }
        if(ans == 1 && s == 'F'){
            ans++;
        }
    }   
    
    if(ans == 2){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N,M,W,T;
string S[10];
map<string,int> m;
int V[10];
ll P[10];
int L[10],X[10],Y[10];
int R[10][10];
ll Q[10][10];
int mindist[1<<7];
ll mincost[8];
ll gain[1<<7];
int dp[1<<7][7];
ll dp2[10][10010];
ll dp3[10010];
int dist(int a,int b){
	return abs(X[a]-X[b])+abs(Y[a]-Y[b]);
}
int main(){
	scanf("%d %d %d %d",&N,&M,&W,&T);
	for(int i=0;i<M;i++){
		cin >> S[i] >> V[i] >> P[i];
		m[S[i]]=i;
	}
	for(int i=0;i<(1<<N);i++){
		for(int j=0;j<N;j++){
			dp[i][j]=INF;
		}
	}
	for(int i=0;i<N;i++){
		cin >> L[i] >> X[i] >> Y[i];
		dp[(1<<i)][i]=abs(X[i])+abs(Y[i]);
		string tmp;
		for(int j=0;j<L[i];j++){
			cin >> tmp >> Q[i][j];
			R[i][j]=m[tmp];
		}
	}
	for(int i=0;i<(1<<N);i++){
		for(int j=0;j<N;j++){
			if(dp[i][j]==INF)continue;
			for(int k=0;k<N;k++){
				if((i>>k)&1)continue;
				chmin(dp[i|(1<<k)][k],dp[i][j]+dist(j,k));
			}
		}
	}
	for(int i=0;i<(1<<N);i++){
		mindist[i]=INF;
		for(int j=0;j<N;j++){
			if(dp[i][j]==INF)continue;
			chmin(mindist[i],dp[i][j]+dp[(1<<j)][j]);
		}
	}
	for(int i=1;i<(1<<N);i++){
		if(mindist[i]>T)continue;
		for(int j=0;j<M;j++)mincost[j]=INF;
		for(int j=0;j<N;j++){
			if((i>>j)&1){
				for(int k=0;k<L[j];k++){
					chmin(mincost[R[j][k]],Q[j][k]);
				}
			}
		}
		int prev = 0;
		for(int j=0;j<M;j++){
			if(mincost[j]==INF)continue;
			for(int k=0;k<=W;k++){
				dp2[j+1][k]=dp2[prev][k];
				if(k>=V[j]){
					chmax(dp2[j+1][k],dp2[j+1][k-V[j]]+(P[j]-mincost[j]));
				}
				chmax(gain[i],dp2[j+1][k]);
			}
			prev = j+1;
		}
	}
	dp3[0]=0;
	for(int i=0;i<=T;i++){
		dp3[i+1]=dp3[i];
		for(int j=1;j<(1<<N);j++){
			if(i>=mindist[j]){
				chmax(dp3[i+1],dp3[i+1-mindist[j]]+(ll)gain[j]);
			}
		}
	}
	printf("%lld\n",dp3[T+1]);
	return 0;
}

Measured memory_bytes: 3888
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))


def linearSearch(A, n, key):
    i = 0
    A.append(key) # ??????
    while A[i] != key:
        i += 1
    A.pop()
    return i != n

count = 0

for i in range(q):
    if linearSearch(S, n, T[i]):
        count += 1

print(count)

Measured memory_bytes: 8404
def read_input():
    s = input()
    return s

def submit():
    s = read_input()
    s = [c for c in s]
    s.sort()
    s = ''.join(s)

    if s == 'abc':
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    submit()


Measured memory_bytes: 2940
N = int(input())
for a in range(1, 3501):
    for b in range(a+1, 3501):
        c2 = 4 * a * b - b * N - a * N
        if c2 <= 0:continue
        c1 = a * b * N
        if c1/c2 == c1//c2:
            print(a,b,c1//c2)
            exit()

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

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

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define flash ios_base::sync_with_stdio(false);     cin.tie(NULL);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) v.begin(),v.end()
#define f first
#define s second



using namespace std;
const ll V = 1e5;

  ll dp[105][V+5];
  std::vector<int> wt(105);
  std::vector<int> v(105);
int main()
{
  flash
  ll n,w;
  cin>>n>>w;


  for(int i=1; i <=n;i++){

    cin>>wt[i]>>v[i];

  }

  //std::vector<std::vector<int>> dp( n+1 , std::vector<int>(w+1,0));


  for(int i=0; i<=n; i++){
       for(int j=0; j<=V; j++){
           dp[i][j] = -1;
       }
   }

   for(int i=0; i<=n; i++)
       dp[i][0] = 0;

  for(int i=1;i<=n;i++){

    for(int j=1;j<=V;j++){


      if( v[i]>j )
        dp[i][j]=dp[i-1][j];
      else{
        ll w1 =  dp[i-1][j];
        ll w2 =  dp[i-1][j-v[i]];
        if(w1==-1 && w2==-1){
          dp[i][j]=-1;
        }
        else if(w1==-1){
          dp[i][j]=w2+ wt[i];
        }
        else if(w2==-1)
                  dp[i][j]=w1;
        else
          dp[i][j] = min( w2+wt[i] , w1 );

      }
    }

  }
  ll result;
  for(int i=0; i<=V; i++){
     if(dp[n][i]==-1)
         continue;
     else if(dp[n][i]<=w){
         //cout<<dp[n][i]<<endl;
         result = i;
     }
 }
  cout<<result<<"\n";


}


Measured memory_bytes: 82460
#include <iostream>
using namespace std;
int main() {
	int n,d;

	cin >> n>>d;

	if (n % (d * 2 + 1)>0) cout << n / (d * 2 + 1) + 1<< endl;
	else cout << n / (d * 2 + 1) << endl;
	
	return 0;
}

Measured memory_bytes: 256
class Dise():
    def __init__(self, aLabelList):
        self.LabelList = aLabelList
        self.NEWS = {"N": [0,4,5,1], 
                     "E": [0,2,5,3], 
                     "W": [0,3,5,2], 
                     "S": [0,1,5,4]} 
        
    def move(self,aNEWS):
        idx = self.NEWS[aNEWS]
        
        tmp = self.LabelList[idx[0]]
        self.LabelList[idx[0]] = self.LabelList[idx[3]]
        self.LabelList[idx[3]] = self.LabelList[idx[2]]
        self.LabelList[idx[2]] = self.LabelList[idx[1]]
        self.LabelList[idx[1]] = tmp

    def DisePrint(self):
        print(self.LabelList[0])

myInstance = Dise(input().split())
 
x = input()
for i in range(len(x)):
    myInstance.move(x[i:i+1])

myInstance.DisePrint()



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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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;}

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

const ll mod = 1e9 + 7;

int check(int a, int b, int c){
    if(a == 1 && c == 0){
        return 2;
    }else if(b == 1 && a == 0){
        return 2;
    }else if(b == 0 && a == 2){
        return 1;
    }else if(c == 0 && b == 1){
        return 2;
    }else if(b == 0 && a == 1){
        return 2;
    }
    return -1;
}

int main(){
    ll n; cin >> n;
    vector<vector<vector<vector<ll> > > > dp(n+1, vector<vector<vector<ll> > >(4, vector<vector<ll> >(4, vector<ll>(4, 0))));
    REP(i, 0, 4){
        REP(l, 0, 4){
            REP(j, 0, 4){
                dp[3][i][l][j] = 1LL;
            }
        }
    }
    dp[3][2][1][0] = 0LL;
    dp[3][1][2][0] = 0LL;
    dp[3][2][0][1] = 0LL;
    REP(i, 4, n+1){
        REP(a, 0, 4){
            REP(b, 0, 4){
                REP(c, 0, 4){
                    REP(d, 0, 4){
                        int ch = check(a, b, c);
                        if(d == 1 && a == 2 && c == 0){
                            //cout << "OK" << ch << endl;
                        }
                        if(ch == d){
                            //cout << d << a << b << endl;
                             continue;
                        }else{
                            dp[i][d][a][b] += dp[i-1][a][b][c];
                            dp[i][d][a][b] %= mod;
                        }
                    }
                }
            }
        }
    }
    ll ans = 0;
    REP(a, 0, 4){
        REP(b, 0, 4){
            REP(c, 0, 4){
                ans += dp[n][a][b][c];
                ans %= mod;
            }
        }
    }
    //cout << dp[n][1][2][0] << endl;
    cout << ans << endl;
}

Measured memory_bytes: 3708
n = gets.to_i
al = Hash.new(0).merge(gets.split.map(&:to_i).tally)
q = gets.to_i

total = al.sum { |k, v| k*v }
q.times do
  b, c = gets.split.map(&:to_i)
  puts total += (c-b)*al[b]
  al[c] += al[b]
  al[b] = 0
end

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

int main(void){
  char bord[3][3]={{'A','B','C'},{'D','E','F'},{'G','H','I'}},first;
  string str;
  int n1,n2;
  bool check;

  while(cin >> str){

    check=true;
    
    for(int i=0;i < 3;i++){
      for(int j=0;j < 3;j++){
	if(str[0]==bord[i][j]){
	  n1=i; n2=j;
	}
      }
    }
    
    for(int i=1;i < str.size();i++){
      if(bord[n1+1][n2]==str[i] && n1!=2){
	n1++;
	continue;
      }
      if(bord[n1-1][n2]==str[i] && n1!=0){
	n1--;
	continue;
      }
      if(bord[n1][n2+1]==str[i] && n2!=2){
	n2++;
	continue;
      }
      if(bord[n1][n2-1]==str[i] && n2!=0){
	n2--;
	continue;
      }
      check=false;
    }
    if(check) cout << str << endl;
  }
}

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


int main() {
    int n;
    cin >> n;
    if(n == 1){
        cout << 1 << endl;
    }else if(n%2 == 0){
        cout << 0.5 << endl;
    }else{
        double t = n/2+1;
        cout << t/n << endl;
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#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>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> w(n), e(n);
    for (int i = 0; i <= n-2; i++) {
        if (s[i] == 'W') w[i+1] = w[i] + 1;
        else w[i+1] = w[i];
    }
    reverse(s.begin(), s.end());
    for (int i = 0; i <= n-2; i++) {
        if (s[i] == 'E') e[i+1] = e[i] + 1;
        else e[i+1] = e[i];
    }
    reverse(s.begin(), s.end());
    int ans = INF;
    rep(i,n) {
        int now = w[i] + e[n-i-1];
        ans = min(ans, now);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6156
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <regex>
#include <stack>
#include <queue>
#include <vector>
#define MAX_N 100
#define INF 10000000

using namespace std;

int a, b;

void solve() {
	if(b!=100)
	if (a == 0) {
		cout << b << endl;
	}
	else if (a == 1)
		cout << b * 100 << endl;
	else
		cout << b * 10000 << endl;
	else if(b==100)
	if (a == 0) {
		cout << 101 << endl;
	}
	else if (a == 1)
		cout << 10100 << endl;
	else
		cout << 1010000 << endl;
}

int main() {
	cin >> a >> b;
	solve();
	return 0;
}

Measured memory_bytes: 256
<?php
list($n) = ints();
$m = 26;
$c = ints();
for ($i = 0; $i < $n; ++$i) {
    $s = ints();
    for ($j = 0; $j < $m; ++$j) $s[$j] += $c[$j] * 180;
    $max = PHP_INT_MIN;
    for ($j = 0; $j < $m; ++$j) {
        if ($max < $s[$j]) {
            $max = $s[$j];
            $maxi = $j;
        }
    }
    $ans[] = $maxi + 1;
}
echo implode(PHP_EOL, $ans);
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 16276
/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed ios::sync_with_stdio(0);cin.tie(0);
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
#define rep(i,a) for(ll i=0;i<a;i++)
#define rep1(i,begin,end) for(ll i=begin;i<=end;i++)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(v)   v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define pi acos(-1)
// bitshift (1LL<<(3)) *2^3
typedef long long int ll;
typedef vector<ll>vi;
typedef map<ll,ll>m;
typedef map<char,ll>mc;
typedef set<ll>st;
typedef set<char>sc;
ll dx[] ={-1,+1,0,0,+1,-1,+1,-1};
ll dy[] ={0,0,-1,+1,+1,+1,-1,-1};
const ll mx = 1e5+123;
bool vis[mx];
vi adj[mx];
int main()
{
    speed;
    ll a,b=0,c=0,d=0,e=0;
    cin>>a;
    for(int i=0;i<a;i++)
    {
        string s;
        cin>>s;
        if(s=="AC")
            b++;
        else if(s=="TLE")
            c++;
        else if(s=="WA")
            d++;
        else if(s=="RE")
            e++;
    }
    cout<<"AC x "<<b<<endl;
    cout<<"WA x "<<d<<endl;
    cout<<"TLE x "<<c<<endl;
    cout<<"RE x "<<e<<endl;
}



Measured memory_bytes: 5984
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 1 << 20;
const int mod = 1000000007;

template <class T1, class T2> inline void addMod(T1& a, T2 b)	{   a = (a + b) % mod;  }
template <class T1, class T2> inline void multMod(T1& a, T2 b)	{   a = a * b % mod;    }

long long qpow(long long a, long long b)
{
    long long res0 = 1;
    for (; b!=0; b>>=1)
    {
        if (b & 1)  multMod(res0, a);
        multMod(a, a);
    }
    return res0;
}

int A[maxN], B[maxN], T[maxN], pi[maxN], n;
vector <pair <int, int> > ans;

void ins(int k)
{
	int x = A[0] ^ B[--k];
	if (k != 0)
		k = n-k;
	ans.pb({k, x});
}

void solve()
{
	scanf ("%d", &n);
	FOR(i, 0, n)
		scanf ("%d", A+i);
	FOR(i, 0, n)
		scanf ("%d", B+i);
	A[n] = A[0], B[n] = B[0];
	int m = 0;
	FOR(i, 0, n)
		T[++m] = A[i] ^ A[i+1];
	T[++m] = -1;
	FOR(_, 0, 2)
		FOR(i, 0, n)
			T[++m] = B[i] ^ B[i+1];
	assert(m == n*3+1);
	int q = 0;
	
	dbg(T, m+1);
	
	FOR(i, 2, m)
	{
		while (q != 0 and T[q+1] != T[i])
			q = pi[q];
		if (T[q+1] == T[i])
			q++;
		pi[i] = q;
		if (q == n)
			ins(i-n+1-n-1);
	}	
	
	sort(ALL(ans));
	
	for (auto k : ans)
		printf("%d %d\n", k.ft, k.sd);
}

int main()
{
	int t;
	t = 1;//scanf ("%d", &t);
	while (t--)
		solve();
	
	return 0;
}


Measured memory_bytes: 17392
#include <iostream>
#include <list>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T>
using Vec = std::vector<T>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())



template <class T> inline int argmin(std::vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(std::vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int BitI(int k){return 1 << k;}
inline lli BitL(int k){return 1L << k;}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





int main(void){
  int n; scanf("%d", &n);
  Vint A(n), B(n);
  REP(i, n) scanf("%d", &A[i]);
  REP(i, n) scanf("%d", &B[i]);
  int res = 0;
  REP(i, n) if(A[i] > B[i]) res += A[i] - B[i];
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
int main(){
    int n;cin>>n;
    int kn[n+2];
    kn[0]=0;kn[n+1]=0;
    int sum=0;
    for(int i=1;i<n+2;i++){
        if(i!=n+1){
       cin>>kn[i];
        }
        sum+=abs(kn[i]-kn[i-1]);
    }
    for(int i=1;i<n+1;i++){
        int s=sum-abs(kn[i-1]-kn[i])-abs(kn[i]-kn[i+1])+abs(kn[i-1]-kn[i+1]);
        cout<<s<<endl;
    }




return 0;
}


Measured memory_bytes: 1664
use proconio::{input, fastout};
use num::integer::gcd;

#[fastout]
fn main() {
    input! {
        (n, k): (usize, i64),
        a: [i64; n]
    }
    
    let mut g: i64 = 0;
    let mut over = false;
    for i in 0..n {
        g = gcd(g, a[i]);
        if a[i]>=k {
            over = true;
        }
    }

    if k%g==0 && over {
        print!("POSSIBLE");
    } else {
        print!("IMPOSSIBLE");
    }
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
int main(void){
	int B[100][100],A[100],a,b,i,j,n,sum;
	char str[100000],*line;

	fgets(str,sizeof(str),stdin);
	sscanf(str,"%d %d",&a,&b);
	for(i=0;i<a;i++){
		fgets(str,sizeof(str),stdin);
		line = strtok(str," ");
		sscanf(line,"%d",&n);
		B[i][0] = n;
		for(j=1;j<b;j++){
			line = strtok(NULL," ");
			sscanf(line,"%d",&n);
			B[i][j] = n;
		}
	}
	for(i=0;i<b;i++){
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%d",&n);
		A[i] = n;
	}
	for(i=0;i<a;i++){
		sum = 0;
		for(j=0;j<b;j++)
			sum += B[i][j]*A[j];
		printf("%d\n",sum);
	}
	return 0;
}

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

using namespace std;

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

    sort(s.begin(), s.end());

    if (s[0]==s[1] && s[1]!=s[2] && s[2]==s[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    la = rli()
    for a in la:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                print("DENIED")
                return
    print("APPROVED")


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    string S;
    cin >> S;
    int ret = 0;
    int cnt = 0;
    for(int i = 0;i < S.size();i++) {
        if(S.at(i) == 'A' || S.at(i) == 'T' || S.at(i) == 'C' || S.at(i) == 'G') {
            cnt++;
        }
        else {
            ret = max(ret,cnt);
            cnt = 0;
        }
    }
    ret = max(ret,cnt);
    cout << ret << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main(string[] args)
	{
        	string input = Console.ReadLine();
       		int num = int.Parse(input);

		var valueList = new List<int>();
		for (int i = 0; i < num;i++) {
			string value = Console.ReadLine();;
			valueList.Add(int.Parse(value));

		}
		int total = 0;
		int max = valueList.Max();
		foreach(var v in valueList) {			
            		total += v;		
		}
		total = total - max + max/2;
        	Console.WriteLine(total);
	}
}


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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct Edge{int from, to; ll cost;};

const ll MOD = 1000000007;
const long double EPS = 10e-10;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int a,b;
    cin >> a >> b;
    int d = b-a;
    cout << (d-1)*d/2 - a << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
int ans;
int n;
int m;
char l[100001];
int main()
{
  string a;
  cin>>a;
  for(int i=0;i<a.size();i++)
  {
  	if(a[i]=='C')l[n++]=a[i];
  	if(a[i]=='F')l[n++]=a[i];
  }
  for(int i=0;i<n;i++)
  {
  	if(l[i]=='C'&&l[i+1]=='F')
  	{
  		m=1;
  	}
  }
  if(m==1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] As = new int[N+1];
		for(int i=0; i<=N; i++) {
			As[i] = Integer.parseInt(sc.next());
		}
		long last = 0;
		long monsters = 0;
		for(int i=0; i<N; i++) {
			long ability = Integer.parseInt(sc.next());
			if(As[i] >= ability + last) {
				monsters += (ability+ last);
				last = 0;
			}else {
				monsters += As[i];
				if(last >= As[i]) {
					last = ability;
				}else {
					last = ability + last - As[i];	
				}
			}
		}
		sc.close();
		if(As[N] >=  last) {
			monsters +=  last;
		}else {
			monsters += As[N];
		}
		System.out.println(monsters);
	}
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	llong N;
	vector<llong> W, rui;

	cin >> N;
	W.resize(N);
	rui.resize(N+1);
	for (int i = 0; i < N; ++i) {
		cin >> W[i];
		rui[i+1] = rui[i] + W[i];
	}

	llong ans = inf;
	for (int i = 1; i < N; i++) {
		ans = min(ans, abs(rui[N] - rui[i] - rui[i]));
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

const int N = 2e5 + 10;

int a[N];

int main() {
	int n;
	cin >> n;
	
	for (int i = 2; i <= n; i++) cin >> a[i];
	
	map<int, int> cnt;
	for (auto k : a) {
		cnt[k]++;
	}
	
	for (int i = 1; i <= n; i++) {
		cout << cnt[i] << '\n';
	}
	
	return 0;
}

Measured memory_bytes: 13788
#pragma comment(linker, "/STACK:10240000")
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 200020;

int h[MAXN];

int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i ++)
    {
        scanf("%d", &h[i]);
    }
    sort(h + 1, h + n + 1);
    long long tot = 0;
    for (int i = n - k; i >= 1; i --)
    {
        tot += (long long)h[i];
    }
    printf("%lld\n", tot);
    return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

import sys
from collections import deque

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

K=INT()

que=deque()
que.append((1, 1))
costs=[-1]*K

while len(que):
    cur,cost=que.popleft()
    if costs[cur]==-1:
        costs[cur]=cost
        que.appendleft((cur*10%K, cost))
        que.append(((cur+1)%K, cost+1))
print(costs[0])


Measured memory_bytes: 14440
#include<cstdio>
#include<string>
#include<queue>
#include<unordered_set>

using namespace std;

int h, w, k;
int x1, y1, x2, y2;
char tmp[1000006];
string c[1000006];
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
unordered_set<int> visited[1000006];

struct custom {
  int r, c, d;
};

queue<pair<custom, pair<int, bool>>> q;

int main() {
  scanf("%d %d %d", &h, &w, &k);
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  for (int i = 0; i < h; i++) {
    scanf("%s", tmp);
    c[i] = tmp;
  }
  for (int j = 1; j <= h; j++) {
    visited[j].reserve(w);
  }
  for (int i = 0; i < 4; i++) {
    q.push({{x1, y1, i}, {0, false}});
    visited[x1].insert(x2);
  }
  int ans = -1;
  while (!q.empty()) {
    custom wtf = q.front().first;
    int dis = q.front().second.first;
    bool can_continue = q.front().second.second;
    q.pop();
    int x = wtf.r;
    int y = wtf.c;
    int d = wtf.d;
    if (x == x2 && y == y2) {
      ans = dis;
      break;
    }
    for (int i = 0; i < 4; i++) {
      if ((i == d && !can_continue) || d == i + 2 || i == d + 2) {
        continue;
      }
      int nx = x + dx[i];
      int ny = y + dy[i];
      int j = 1;
      while (1 <= nx && nx <= h && 1 <= ny && ny <= w && c[nx-1][ny-1] == '.' && j <= k) {
        if (visited[nx].find(ny) == visited[nx].end()) {
          if (j == k) {
            q.push({{nx, ny, i}, {dis + 1, true}});
          } else {
            q.push({{nx, ny, i}, {dis + 1, false}});
          }
          visited[nx].insert(ny);
        }
        nx += dx[i];
        ny += dy[i];
        j++;
      }
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 117632
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    val s = br.readLine()!!

    val a = s.substring(0, n / 2)
    val b = s.substring(n / 2, n)
    val ans = if (a == b) "Yes" else "No"
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

#define INF 1234567890
#define ll long long

int A, B, C, K;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> A >> B >> C >> K;
	int cnt = 0;
	while(A >= B)
	{
		B *= 2;
		cnt++;
	}
	while(B >= C)
	{
		C *= 2;
		cnt++;
	}
	if (cnt <= K) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 3648
import bisect

N = int(input())

border = N * 2

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

b = [A[0] + 1]

C = [0] * (border + 1)

ans = 0

for i, a in enumerate(A, 1):
    if 0 <= i - a <= border:
        ans += C[i - a]
    if i + a <= border:
        C[i + a] += 1
    #br = bisect.bisect_right(b, i - a)
    #bl = bisect.bisect_left(b, i - a)
    #ans += br - bl
    #b.index(bl, i + a)

print(ans)

Measured memory_bytes: 32244