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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N; cin >>N;
    string S; cin >> S;
    
    int ans = 1;

    rep1(i, N) {
        if (S[i] != S[i - 1])
            ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main() {
	string s1="",s2="",s;
	cin>>s;
	bool flag = false;

	for(int i=0;i<s.size()/2;i++){
		
		s1 += s[i];
	}
	for(int i=(s.size()+3)/2-1;i<s.size();i++){
		s2 += s[i];
	}
	//cout<<s1<<" "<<s2<<endl;
	if(s1 != s2)
		cout<<"No"<<endl;
	else
		cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
op = ["+", "-", "*"]
while True:
    a, b, c, d = map(str, raw_input().split())
    if a == "0" and c == "0":
        break
    n = [0,1,2,3]
    q = [a,b,c,d]
    flag = 0
    for ii in n:
        m = [0,1,2,3]
        m.remove(ii)
        for jj in m:
            l = [0,1,2,3]
            l.remove(ii);l.remove(jj)
            for kk in l:
                o = [0,1,2,3]
                o.remove(ii);o.remove(jj);o.remove(kk)
                for ll in o:
                    for i in op:
                        for j in op:
                            for k in op:
                                if eval( "((("+q[ii]+k+q[jj]+")"+j+q[kk]+")"+i+q[ll]+")") == 10:
                                    print "(((",q[ii],k,q[jj],")",j,q[kk],")",i,q[ll],")"
                                    flag = 1
                                    break
                                if eval( "(("+q[ii]+k+q[jj]+")"+i+"("+q[kk]+j+q[ll]+"))" ) == 10:
                                    print "((",q[ii],k,q[jj],")",i,"(",q[kk],j,q[ll],"))"
                                    flag = 1
                                    break
                            if flag == 1:
                                break
                        if flag == 1:
                            break
                    if flag == 1:
                        break
                if flag == 1:
                    break
            if flag == 1:
                break
        if flag == 1:
            break
    if flag == 0:
        print 0

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

int main(){
	int k,s;
	cin >> k >> s;
	int co = 0;
	for(int i= 0; i <= k; i++){
		for(int j=0; j<= k; j++){
			if((s-(i+j))<=k && s>=(i+j)) co++;
		}
	}
	cout << co << endl;
}


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


bool mani(int a[12], int n)
{
	int b[12];
	fill(b, b + 12, 0);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if (a[i] == a[j])
				b[i]++;
	bool f = true;
	for (int i = 0; i < n; i++)
	{
		if (a[i] != b[i])
		{
			f = false;
			break;
		}
	}
	for (int i = 0; i < n; i++)
		a[i] = b[i];
	return f;
}


int main()
{
	int n, a[12];
	while (cin >> n && n != 0)
	{
		int c = 0;
		for (int i = 0; i < n; i++)
			cin >> a[i];
		while (true)
		{
			if (mani(a, n))
				break;
			c++;
		}
		cout << c << endl;
		cout << a[0];
		for (int i = 1; i < n; i++)
			cout << " " << a[i];
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<vector<int>> c(3,vector<int>(3));
	rep(i,3) rep(j,3) cin >> c[i][j];
	vector<int> a(3),b(3);
	rep(i,c[0][0] + 1){
		rep(j,3) b[j] = c[0][j] - i;
		rep(j,3) a[j] = c[j][0] - b[0];
		bool ok = true;
		rep(j,3) rep(k,3){
			if(c[j][k] != a[j] + b[k]) ok = false;
		}
		if(ok){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ull>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef __uint128_t ull;
typedef long double ld;
using namespace std;

const ull h = 9007199254740881;
const ull B = 92709568269121;
long long n, l;
map<ull, ull> mp;
vvl G = VV(500000, 0, 0, ull);

ull get_g(ull x){
  if(x==0) return 0;
  ull ret = 1;
  while(x%2==0) x/=2, ret*=2;
  return ret;
}

ull dfs(ull now, ull from, ull d){
  ull ret = 0;
  if(G[now].size()==1) ret ^= get_g(d);
  for(auto to:G[now]) ret ^= dfs(to, now, d-1);
  return ret;
}

//-------------------------------------------------------------------
#include <sstream>
#include <fstream>
ifstream ifs;
void init(string s){ifs.open(s);}
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while(getline(ss, buffer, sep)) v.push_back(buffer);
    return v;
}
ull read(){
  string str;
  getline(ifs, str);
  return stoll(str);
}
string read_str(){
  string str;
  getline(ifs, str);
  return str;
}
vector<ull> read_vec(){
  string str;
  getline(ifs, str);
  std::vector<ull> num;
  vector<string> data = split(str, ' ');
  for(int i=0;i<data.size();i++) num.push_back(stoll(data[i]));
  return num;
}
vvl read_mat(ull h){
  string str;
  vvl num = VV(h, 0, 0, ull);
  for(int i=0;i<h;i++){
    getline(ifs, str);
    vector<string> data = split(str, ' ');
    for(int j=0;j<data.size();j++) num[i].push_back(stoll(data[j]));
  }
  return num;
}
//-------------------------------------------------------------------

int main(int argc, char const *argv[]) {
  std::cin >> n >> l;
  //init("1_09.txt");
  //vector<ull> t = read_vec();
  //n = t[0], l = t[1];
  mp.emplace(988233445, 0);
  for(int i=0;i<n;i++){
    string s;std::cin >> s;
    ull tmp = 988233445;
    for(int j=0;j<s.size();j++){
      ull prev = tmp;
      ull now = s[j]%h;
      tmp = ((tmp*B)%h + now)%h;
      //if(mp.find(tmp)!=mp.end()) std::cout << j << endl;
      if(mp.find(tmp)==mp.end()) {
        mp.emplace(tmp, mp.size());
        G[mp.at(prev)].push_back(mp.at(tmp));
      }
    }
  }
  //int y = dfs(0, -1, l);
  //std::cout << y << '\n';
  std::cout << (dfs(0, -1, l)?"Alice":"Bob") << '\n';
  return 0;
}


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

using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

vector<ll> acc;
vector<ll> acc_e;

ll solve(ll x, vector<ll> &A) {
    ll ok = 0, ng = 1e18 + 120;
    int N = A.size();
    while(ng - ok > 1) {
        ll c = (ok + ng) / 2;
        ll k1 = lower_bound(all(A), x - c) - A.begin();
        ll k2 = upper_bound(all(A), x + c) - A.begin();
        if (k2 - k1 <= N - k2) {
            ok = c;
        } else {
            ng = c;
        }
    }
    ll k1 = lower_bound(all(A), x - ok) - A.begin();
    ll k2 = upper_bound(all(A), x + ok) - A.begin();
    return (acc[N] - acc[k2]) + (((k1 % 2) ^ (N - k2 > k2 - k1)) ? acc_e[k1] : (acc[k1] - acc_e[k1]));
}

void solve() {
    int N, Q;
    cin >> N >> Q;
    vector<ll> A(N);
    acc.resize(N + 1);
    acc_e.resize(N + 1);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i] *= 4;
        acc[i + 1] = acc[i] + A[i];
        acc_e[i + 1] = acc_e[i] + ((i % 2 == 0) ? A[i] : 0);
    }

    for (int q = 0; q < Q; q++) {
        ll x; cin >> x;
        cout << solve(x * 4 - 1, A) / 4 << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 4096
#include<stdio.h>

#define N 500000
#define INFTY 1000000000

void merge(int *,int ,int,int);

void mergeSort(int * , int, int);

int A[N];
int count;

int main(){
  int i,j,n,left,right;

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

  left = 0;
  right = n;
  mergeSort(A,left,right);
  
  for(j = 0;j < n;j++){
    if(j == n - 1){
      printf("%d",A[j]);
    }
    else printf("%d ",A[j]);
  }
  printf("\n%d\n",count);
  
  return 0;
}


void mergeSort(int A[],int left,int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  int L[n1],R[n2];
  for(i = 0;i <= n1 -1;i++){
    L[i] = A[left + i];
  }
  for(i = 0;i <= n2 - 1;i++){
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for(k = left;k <= right - 1;k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      count++;
    }
    else{
      A[k] = R[j];
      j = j + 1;
      count++;
    }
  }
}



Measured memory_bytes: 5632
#include <stdio.h>

int check(int,int,int);

int main(){
  int n,i;
  int a,b,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d%d",&a,&b,&c);
    if(check(a,b,c)==1)printf("YES\n");
    else printf("NO\n");
  }

  
  return 0;
}

int check(int a,int b,int c){
  int a2=a*a;
  int b2 = b*b;
  int c2 = c*c;
  if(a2==b2+c2)return 1;
  if(b2==a2+c2)return 1;
  if(c2==a2+b2)return 1;
  return 0;
}



Measured memory_bytes: 1924
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n,d,aux1,aux2,cnt=0; cin>>n>>d;
  while(n--){
    cin>>aux1>>aux2;
    if(sqrt(aux1*aux1+aux2*aux2)<=d)
      cnt++;
  }
  cout<<cnt;
  return 0;
}

Measured memory_bytes: 3716
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        String s = sc.next();
        String t = sc.next();
        System.out.println(t.startsWith(s) && s.length()+1 == t.length() ? "Yes" : "No");
    }
}



Measured memory_bytes: 35696
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, T;
  int A, B;
  string U;
  
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  
  if(U == S){
    cout << A - 1 << ' ' << B << endl;
  }
  
  else if(U == T){
    cout << A << ' ' << B - 1 << endl;
  }
  
}

Measured memory_bytes: 256
/* Priyansh Agarwal*/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<algorithm>
#include<unordered_map>
#include<vector>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<map>
#include<chrono>
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define nline "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define debug(x) cout << #x << " " << x <<endl;
#define set_bits __builtin_popcount
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > pbds;
/*---------------------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
ll expo(ll a, ll b, ll mod) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
void extendgcd(ll a, ll b, ll*v) {if (b == 0) {v[0] = 1; v[1] = 0; v[2] = a; return ;} extendgcd(b, a % b, v); ll x = v[1]; v[1] = v[0] - v[1] * (a / b); v[0] = x; return;} //pass an arry of size 3
ll mminv(ll a, ll b) {ll arr[3]; extendgcd(a, b, arr); return arr[0];} //for non prime b
ll mminvprime(ll a, ll b) {return expo(a, b - 2, b);}
bool revsort(ll a, ll b) {return a > b;}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
ll combination(ll n, ll r, ll m, ll* fact) {ll val1 = fact[n]; ll val2 = mminvprime(fact[r], m); ll val3 = mminvprime(fact[n - r], m); return ((val1 * val2) % m * val3) % m;}
void google(int t) {cout << "Case #" << t << ": ";}
vector<int> sieve(int n) {int*arr = new int[n + 1](); vector<int> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
/*--------------------------------------------------------------------------------------------------------------------------*/
void solve()
{
	int t;
	// cin >> t;
	int total = 0;
	t = 1;
	while (t--)
	{
		int n, k;
		cin >> n >> k;
		ll arr[n];
		for (int i = 0; i < n; i++)
			cin >> arr[i];
		for (int i = k; i < n; i++)
		{
			if (arr[i] > arr[i - k])
				cout << "Yes" << endl;
			else
				cout << "No" << endl;
		}
	}
}
int main()
{
	fastio();
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
	freopen("Error.txt", "w", stderr);
#endif
	auto start1 = high_resolution_clock::now();
	solve();
	auto stop1 = high_resolution_clock::now();
	auto duration = duration_cast<microseconds>(stop1 - start1);
#ifndef ONLINE_JUDGE
	cerr << "Time: " << duration.count() / 1000.0 << endl;
#endif
	return 0;
}

Measured memory_bytes: 5196
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

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

        var list = new List<int>(num);

        for(int i = 0; i < num; ++i)
        {
            list.Add(int.Parse(Console.ReadLine()));
        }

        list.Sort( (A, B) =>
        {
            return B - A;
        });

        list[0] = list[0] / 2;

        Console.WriteLine(list.Sum());
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<vector<int>>ki(N);
    vector<P>ab;
    for(int i = 0; i < N-1; i++) {
        int a,b;
        cin >> a >> b;
        a--;b--;
        ki[a].push_back(b);
        ki[b].push_back(a);
        ab.push_back({a,b});
    }
    map<P,int>Mp;
    vector<int>used(N,-1);
    used[0] = 0;
    queue<int>que;
    que.push(0);
    int cnt1 = 0;
    while(!que.empty()) {
        int X = que.front();
        que.pop();
        int cnt2 = 1;
        for(int i = 0; i < ki[X].size(); i++) {
            int Y = X,Z = ki[X][i];
            if(Y > Z) {
                swap(Y,Z);
            }
            if(used[X] == cnt2) {
                cnt2++;
            }
            if(used[ki[X][i]] == -1) {
                Mp[{Y,Z}] = cnt2;
                used[ki[X][i]] = cnt2;
                que.push(ki[X][i]);
                cnt2++;
            }
        }
        cnt1 = max(cnt1,cnt2-1);
    }
    cout << cnt1 << endl;
    for(int i = 0; i < N-1; i++) {
        cout << Mp[ab[i]] << endl;
    }
}

Measured memory_bytes: 17848
N,M,K=map(int,input().split())
A=[]
B=[]
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=[0 for i in range(len(A)+1)]
for i in range(1,len(A)+1):
    a[i]=a[i-1]+A[i-1]

b=[0 for i in range(len(B)+1)]
for i in range(1,len(B)+1):
    b[i]=b[i-1]+B[i-1]

j=M
ans=0
for i in range(len(A)+1):

    if(K<a[i]):
        break
    #print(a[i]+b[j])
    while(a[i]+b[j]>K):
        j=j-1
    ans=max(ans,i+j)

print(ans)


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

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

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

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

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

  	int ans = 0;
  for(auto x : s)
    if(x == '1')
      ans++;
  cout << ans << endl;

	return 0;
}

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

using namespace std;
using ll=long long;

const ll INF = 0x3f3f3f3f3f3f3f3f;
const int N = 300; 

ll d[N][N];
ll a[N][N];
void solve() {
    int n,m, L;
    cin >> n >> m >> L;
    memset(d, 0x3f, sizeof d);
    for (int _ = 0; _ < m; _++) {
        int x,y,z;
        cin >> x >> y >> z;
        x--;y--;
        if (z > L) continue;
        d[x][y] = d[y][x] = z;
    }
    for (int i = 0; i < n; i++) {
        d[i][i] = 0;
    }

    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (d[i][k] < INF && d[k][j] < INF) {// for negative
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
    }
    
    memset(a, 0x3f, sizeof a);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (d[i][j] <= L) a[i][j] = 1;
        }
    }
    for (int i = 0; i < n; i++) {
        a[i][i] = 0;
    }
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (a[i][k] < INF && a[k][j] < INF) {// for negative
                    a[i][j] = min(a[i][j], a[i][k] + a[k][j]);
                }
            }
        }
    }


    int q; cin >> q;
    while (q--) {
        int x,y;
        cin >> x >> y;
        x--;y--;
        int res = a[x][y] == INF? -1: a[x][y]-1;
        cout << res << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 1920
package main

import "fmt"

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func main() {
	var x, a, b int
	fmt.Scan(&x, &a, &b)
	if abs(a-x) > abs(b-x) {
		fmt.Println("B")
		return
	}
	fmt.Println("A")
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(string, o, e);
	string ans = "";
	REP(i, o.size()) {
		ans += o[i];
		if (i == e.size()) break;
		ans += e[i];
	}
	OUT(ans)BR;
  
  return 0;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(1,n-1):
    dp[i+1]=min(dp[i]+abs(h[i]-h[i+1]), dp[i-1]+abs(h[i-1]-h[i+1]))
print(dp[-1])

Measured memory_bytes: 52208
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  while(true){
    bool NA=true;
    int cnt=0;
    int n;cin>>n;
    if(n==0){break;}
    vector<int> k(n);
    for(int i=0;i<n;i++){
      cin>>k[i];
      if(k[i]>1){NA=false;}
      if(k[i]>0){cnt++;}
    }
    if(NA){
      cout<<"NA"<<endl;
    }else{
      cout<<cnt+1<<endl;
    }
  }
}


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

#define pb push_back

int n,m,dist[100010],cor[100010],gr[100010];
vector<int> G[100010];
int ans=0;
void dfs(int v){
	cor[v]=1;
	int parc=0;
	for(auto &u:G[v]){
		if(!cor[u]){	
			dfs(u);
		}
		parc= max(dist[u],parc);
	}
	dist[v] = parc+1;
	ans = max(ans,dist[v]-1);
}

int32_t main(){
	cin >> n >> m;
	while(m--){
		int x,y;
		cin >> x >> y;
		gr[y]++;
		G[x].pb(y);
	}
	for(int i=1;i<=n;i++){
		if(!gr[i])
			dfs(i);
	}
	cout << ans << '\n';
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long 
#define F(n) for(int i = 0; i < n; ++i)
#define Debug cout<<endl<<"I AM IRONMAN"<<endl

int main ()
{
    fastio;
    int n,m;
    cin >> n >> m;
    cout << n-m+1;
    return 0;
}

Measured memory_bytes: 256
def main():

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

    wvn = [ list( map(int, input().split()) ) for _ in range(N) ]


    tab = [[0]*(W+1) for _ in range(N+1)] 

#    print(tab)

    wvn.sort(key = lambda x : x[1], reverse = True )
    wvn.sort(key = lambda x : x[0] )


    #i番目の荷物を追加で使ってみる
    for i in range(1, N + 1 ):

        #重さがwiのときのcase
        for wi in range(1, W+1 ):

            wv = wvn[i-1]


            a = tab[i-1][wi]
            b = tab[i][wi-1]
            
            c = 0
            if wi>=wv[0] :
                t = tab[i-1][wi-wv[0]] + wv[1]
                c = max(c,t)
            
#            print(( (i,wi), a,b,c))

            tab[i][wi] = sorted([a,b,c])[-1]


    print(tab[-1][-1])

#    for row in tab:
#        print(row)



main()

Measured memory_bytes: 119788
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    cnt = collections.Counter(A)

    for k, v in cnt.items():
        if k == 0 and v != 1:
            print(0)
            exit()
        elif k != 0 and v != 2:
            print(0)
            exit()
    print((2 ** (N // 2))%MOD)


if __name__ == '__main__':
    main()


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

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

    int x = 0, res = 0;
    for (int i = 0; i < N; i++)
    {
        if (S.at(i) == 'I')
            x++;
        else
            x--;
        res = max(res, x);
    }
    cout << res << endl;
    return 0;
}


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

int main(){
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	for(int i = 0; i < n; i++)
		a[i] = i + 1;
	do {
		for(int i = 0; i < n - 1; i++)
			printf("%d ", a[i]);
		printf("%d\n", a[n-1]);
	} while(next_permutation(a.begin(), a.end()));
}



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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

string s;
int n;
map<string ,int> M;

int32_t main()
{
    IOS
    cin>>n;
    int mx=0;
    for (int i=1;i<=n;i++)
    {
        cin>>s;
        M[s]++;
        mx=max(mx,M[s]);
    }
    vector<string> v;
    for (auto i:M)
    {
        if (i.S==mx) v.pb(i.F);
    }
    sort(all(v));
    for (auto i:v) cout<<i<<endl;
}



Measured memory_bytes: 25584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#define N 200010
#define ls x << 1
#define rs x << 1 | 1
#define inf 0x3f3f3f3f
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define mid ((l + r) >> 1)
#define int long long
#define XRZ 1000000007
#define debug() puts("XRZ TXDY");
#define mem(i, x) memset(i, x, sizeof(i));
#define Next(i, u) for(register int i = head[u]; i ; i = e[i].nxt)
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout);
#define Rep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define Dep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
int dx[10] = {1, -1, 0, 0};
int dy[10] = {0, 0, 1, -1};
using namespace std;
inline int read() {
    register int x = 0, f = 1; register char c = getchar(   );
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}

int n, A[N], Ans, sum[N];
signed main() { n = read();
    Rep(i, 1, n) sum[A[i] = read()] ++;
    Rep(i, 1, N) Ans += sum[i] * (sum[i] - 1) / 2;
    Rep(i, 1, n) { int now = Ans;
        now -= sum[A[i]] * (sum[A[i]] - 1) / 2;
        now += (sum[A[i]] - 1) * (sum[A[i]] - 2) / 2;
        printf("%lld\n", now);
    }
	return 0;
}

Measured memory_bytes: 4736
N = int(input())
a = [int(i) for i in input().split()]
frag = 1
i = 0
count = 0
while frag:
    frag = 0
    for j in range(N-1,i,-1):
        if a[j] < a[j-1]:
            a[j], a[j-1] = a[j-1], a[j]
            count += 1
        frag = 1
        
    i += 1

print(" ".join(map(str, a)))
print(count)

Measured memory_bytes: 7748
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <climits>
int main()
{
    long N;
    std::cin >> N;
    long T,A;
    std::cin >> T >> A;
    long H[1000+1];
    for(long i=1; i<=N; i++){
        std::cin >> H[i];
    }
    long index=1;
    double tmp=T-H[1]*0.006;
    for(long i=2; i<=N; i++){
        if(fabs(A-(T-H[i]*0.006))<fabs(A-tmp)){
            tmp=T-H[i]*0.006;
            index=i;
        }
    }
    std::cout << index << std::endl;
    return 0;
}

Measured memory_bytes: 3556
#include <iostream>
// #include <ctype.h>
#include <string>
using namespace std;
string str_lower(string t) //文字列を全て小文字に変換する関数
{
    int i = 0;
    while (t[i]) //\0まで
    {
        t[i] = tolower(t[i]);
        i++;
    }
    return t;
}

// bool exist(string t, string w)
// {
//     return t == w;
//     // if (t == w)
//     // {
//     //     return true;
//     // }
//     // return false;
// }
int cnt_word(string t, string w)
{
    if (t == w) //単語の文字数も条件に追加した
    {
        return 1;
    }
    return 0;
}
int main(void)
{
    string w;
    string end = "END_OF_TEXT";
    string t;
    int n = 0; //文章ｔの中に含まれる単語ｗの数

    cin >> w;
    cin >> t; //単語単位で読み込むことにした

    while (t != end) //じでない間繰り返す
    {
        t = str_lower(t);
        if (t == w)
        {
            n++;
        }
        // n += cnt_word(t, w);
        cin >> t;
    }
    cout << n << endl;

    return 0;
}


Measured memory_bytes: 3140
for i in range(50):
    m, f, r = list(map(int, input().split()))
    sum = m + f
    if m == f == r == -1:
        break
    else:
        if m == -1 or f == -1 or (0<=sum and sum<30):
            print('F')
        elif sum < 50 and r < 50:
            print('D')
        elif sum < 65 or 50 <= r:
            print('C')
        elif sum < 80:
            print('B')
        else:
            print('A')


Measured memory_bytes: 5592
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for (int i=(a); i<(b); i++)
#define per(i,a,b) for (int i=(b-1); i>=(a); i--)
#define de(x) cout << #x << " => " << x << endl
using namespace std;

#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;

#define pb push_back
typedef vector<int> vi;

typedef long long ll;
typedef long double ld;

///----------------------------------------------
int col[200][200], n, m;
int x = 0, y = 0, dir = 1;
void paint(int c, int num) {
	rep(i, 0, num) {
		col[x][y] = c;
		if (x + dir < 0 || x + dir >= n) {
			y++; dir*=-1;
			continue;
		}
		x += dir;
		//de(x);
		//de(y);
	}
}
//---
int main() {

	///read
	cin >> n >> m;
	int k; cin >> k;
	rep(i, 0, k) {
		int num; scanf("%d", &num);
		paint(i + 1, num);
	}

	///print
	rep(i, 0, n) {
		rep(j, 0, m) {
			if (j > 0) printf(" ");
			printf("%d", col[i][j]);
		}
		printf("\n");
	}



}


Measured memory_bytes: 384
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());
		
		if(n % 10 == 7) {
			System.out.println("Yes");
			return;
		}
		n = n /10;
		if(n % 10 == 7) {
			System.out.println("Yes");
			return;
		}
		n = n/10;
		if(n% 10 == 7) {
			System.out.println("Yes");
			return;
		}
		
		System.out.println("No");
		

	}

}


Measured memory_bytes: 26928
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int A,B,C,D ;
  cin >> A >> B >> C >> D ;
  int L=A+B,R=C+D ;

  if (L<R){
   cout << "Right" << endl ; 
  }
  else if (L==R){
   cout << "Balanced" << endl ; 
  }
  else if (L>R){
   cout << "Left" << endl ; 
  }
  
}
  

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

int main(void) {
	int n, m;
	priority_queue<int> q;
	cin >> n >> m;
	int num;
	for (int i = 0; i < n; i++) {
		cin >> num;
		q.push(num);
	}
	int discount;
	for (int i = 0; i < m; i++) {
		discount = q.top();
		q.pop();
		q.push(discount / 2);
	}
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		ans += q.top();
		q.pop();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 892
N=int(input())
from collections import defaultdict
d=defaultdict(int)
for a in map(int,input().split()):
    d[a]+=1
data=[]
for i in d.keys():
    data.append((i,d[i]))
data.sort(key=lambda x:x[0],reverse=True)
res=[]
for x,y in data:
    if len(res)>=2:break
    if y>=4:
        res.append(x)
        res.append(x)
    elif y>=2:
        res.append(x)
res.append(0)
res.append(0)
print(res[0]*res[1])

Measured memory_bytes: 24224
N,K = map(int,input().split())
A = list(map(int,input().split()))

dp = [0]*(K+1)
for k in range(1,K+1) :
    for a in A :
        if k-a >= 0 and dp[k-a] == 0 :
            dp[k] = 1

print("First" if dp[K] else "Second")


Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    string s,ans;
    cin>>s;
    int cnt=0;
    REP(i,s.size()){
        if(i==0)ans+=s[i];
        else if(i==s.size()-1)ans+=to_string(cnt)+s[i];
        else cnt++;
    }
    cout<<ans<<endl;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //ll X, K, D;
            long[] XKD = Console.ReadLine().Split(" ").Select(x => long.Parse(x)).ToArray();

            //cin >> X >> K >> D;

            long X = XKD[0];
            long K = XKD[1];
            long D = XKD[2];
            X = Math.Abs(X);

            //X = abs(X);

            long straight = Math.Min(K, X / D);
            K -= straight;
            X -= straight * D;

            if (K % 2 == 0)
            {
                Console.WriteLine(X);
            }
            else
            {
                Console.WriteLine(D - X);
                
            }
        }
    }
}
//int[] N = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();

Measured memory_bytes: 28220
h,n = map(int,input().split())
a = []
b = []
for i in range(n):
    A,B = map(int,input().split())
    a.append(A)
    b.append(B)
dp = [float("inf") for _ in range(h + 1)]
dp[0]=0
for i in range(h):
    for j in range(n):
        dp[min(i + a[j],h)] = min(dp[min(i + a[j],h)],dp[i] + b[j])
print(dp[h])

Measured memory_bytes: 43484
# coding: utf-8
# Your code here!
n=int(input())
a=input().rstrip().split(" ")
b=input().rstrip().split(" ")
a[n]=int(a[n])
for i in range(n):
    a[i]=int(a[i])
    b[i]=int(b[i])
ans=0
for i in range(n):
    if(a[i] >b[i]):
        a[i]=a[i]-b[i]
        ans=ans+b[i]
       # print(ans)
        b[i]=0
    else:
        ans=ans+a[i]
        #print(ans)
        
        b[i]=b[i]-a[i]
        a[i]=0
        if(b[i] < a[i+1]):
            ans=ans+b[i]
           # print(ans)
            a[i+1]=a[i+1]-b[i]
            b[i]=0
        else:
            ans=ans+a[i+1]
            #print(ans)
          
            a[i+1]=0
print(ans)

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

int main(){
  vector<int> N(3);
  for(int i=0; i<3; i++) cin >> N[i];
  N[0]-=N[2]; N[1]-=N[2]; N[2]=N[0]-N[1];
  for(int i=0; i<3; i++) N[i]=abs(N[i]);
  sort(N.begin(), N.end());
  cout << N[0]+N[1] << endl;
  return 0;
}

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

void Rotation(char array[][9])
{
  char tmp[9][9];
  
  memset(tmp, '\0', sizeof(tmp));
  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      tmp[j][i] = array[7 - i][j];
    }
  }

  for (int i = 0; i < 8; i++){
    for (int j = 0; j < 8; j++){
      array[j][i] = tmp[j][i];
    }
  }
  for (int i = 0; i < 8; i++) printf("%s\n", array[i]);
}
int main()
{
  char array[9][9];

  for (int i = 0; i < 8; i++) scanf("%s", array[i]);

  for (int i = 0; i < 3; i++){
    printf("%d\n", (i + 1) * 90);
    Rotation(array);
  }

  return (0);
}

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

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")


long long int n, ans;
map < pair <string, string> , int> st;
set <string> an;
string s, s1, s2;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s;
	for (int mask = 0; mask < (1 << n); mask++){
		for (int j = 0; j < n; j++){
			bool ch = (mask & (1 << j));
			if(ch) s1 += s[j];
			else s2 += s[j];
		}
		st[{s1, s2}]++;
		s1 = s2 = "";
	}
	for (int mask = 0; mask < (1 << n); mask++){
		for (int j = 0; j < n; j++){
			bool ch = (mask &  (1 << j));
			if(ch) s1 += s[j + n];
			else s2 += s[j + n];
		}
		reverse(&s2[0], &s2[s2.size()]);
		reverse(&s1[0], &s1[s1.size()]);
  		ans += st[{s2, s1}];
	 	s1 = s2 = "";
	 	
	}
	cout << ans;
}

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

#define INF (INT64_MAX)
#define MOD (1000000000+7)
#define MAX 100000

int N;
long long K;
long long A[MAX];

int b[40];

int main() {
	cin >> N >> K;
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	for( int i = 0; i < N; i++ ) {
		long long a = A[i];
		for( int j = 0; j < 40; j++ ) {
			long long mask = 1LL << j;
			if( a & mask ) {
				b[j]++;
			}
		}
	}

	long long ans = 0;
	for( int i = 0; i < N; i++ ) {
		ans += A[i] ^ K;
	}
	for( int i = 0; i < 40; i++ ) {
		if( ( (K >> i) & 1LL) == 0 ) {
			continue;
		}
		long long sum = 0;
		for( int j = 0; j < i; j++ ) {
			sum += (1LL << j) * max( b[j], N - b[j] );
		}
		sum += (1LL << i) * b[i];
		for( int j = i + 1; j < 40; j++ ) {
			if( (K >> j) & 1LL ) {
				sum += (1LL << j) * (N - b[j]);
			}
			else {
				sum += (1LL << j) * b[j];
			}
		}
		ans = max( ans, sum );
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>

#pragma warning(disable:4996)

using namespace std;

int main() {
  string o, e;
  cin >> o >> e;
  for (int i = 0; i < o.size(); ++i) {
    cout << o[i];
    if (e.size() > i) {
      cout << e[i];
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define loop(i,a,n) for(ll i=a;i<n;++i)
#define revloop(i,a,b) for(ll i=a;i>=b;--i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 9999999999999999
#define MOD 1000000007

void func()
{
    string s,t;
    cin>>s>>t;
    ll n=s.length();
    ll n1=t.length();
    ll ans=n1;
    loop(i,0,n-n1+1){
        string k=s.substr(i,n1);
        ll cnt=0;
        loop(i,0,n1){
            if(k[i]!=t[i])
                ++cnt;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w" , stdout);
    #endif
 
    ll t=1;
    //cin>>t;
    //solve();
    while(t--)
    {
        func();
    }

}


Measured memory_bytes: 3600
from math import sqrt

n, d = map(int, input().split())
x = []
for _ in range(n):
    x.append(list(map(int, input().split())))
ans = 0
for i in range(n):
    for j in range(n):
        if i != j:
            t = 0
            for a, b in zip(x[i], x[j]):
                t += abs(a - b)**2
            if sqrt(t) == int(sqrt(t)):
                ans += 1

print(ans//2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,a) FOR(i,0,(int)(a)-1)
#define reset(a,b) memset(a,b,sizeof(a))
#define BUG(x) cout << #x << " = " << x << endl
#define mod 1000000007
#define pi acos(-1)
#define eps 0.00000001
#define pb push_back
#define sqr(x) (x) * (x)
#define _1 first
#define _2 second

string s;
char a, b;

int main() {
  ios::sync_with_stdio(false);
  cin >> s;
  a = s[0];
  b = s[s.size() - 1];
  int cnt = 0;
  for (char c: s) {
    if (c == a) {
      cnt++;
      swap(a, b);
    }
  }
  if (a == b) {
    cnt = 0;
    for (char c: s) if (c == a) cnt++;
    cnt += cnt - 1;
  }
  // BUG(cnt);
  cnt = s.size() - cnt;
  // BUG(cnt);
  if (cnt & 1) cout << "First";
  else cout << "Second";
}


Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define length(array) (sizeof(array) / sizeof(*array))
#define p_var(var) (cout << #var << " = " << var << endl)


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

	int n;
	cin >> n;
	for(int i=0; i<n; i++) {
		string input;
		cin >> input;
		set<string> pattern;
		string front, rear;
		
		pattern.clear();
		front = rear = "";
		
		for(int j=1; j<=input.size()-1; j++) {
			front = input.substr(0, j);
			rear = input.substr(j);
			
			for(int k=0; k<4; k++) {
				pattern.insert(front+rear);
				pattern.insert(rear+front);

				if(k % 2 == 0)
					reverse(front.begin(), front.end());
				else
					reverse(rear.begin(), rear.end());
			}
		}
		cout << pattern.size() << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1300
#include <stdio.h>
#include <math.h>

int main(){
	int a, h, i, count=0;
	
	scanf("%d %d", &h, &a);
	for(i = 0; h > 0; i++){
		h-=a;
		count++;
	}
	printf("%d", count);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    int tmpp;
    int count=0;
    cin >> n;
    vector<int> vec(n),vecSort(n);
    for (int i = 0; i < n; i++)
    {
        cin >> tmpp;
        vec[i] = tmpp;
    }
    vecSort = vec;
    sort(vecSort.begin(), vecSort.end());
    if (vecSort[n / 2 - 1]== vecSort[n / 2])
    {
        count = 0;
    }
    else
    {
        count = vecSort[n / 2] - vecSort[n / 2 - 1];
    }
    cout << count;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define SZ(X) ((int64_t)((X).size()))
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define intmax (std::numeric_limits<int64_t>::max() / 4)
#define doublemax (std::numeric_limits<double>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);




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

	int A, B;
	cin >> A >> B;
	cout << (A + B) % 24 << endl;




	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,i,max=-1000001,min=1000001,a;
	long sum=0;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&a);
		sum+=a;
		if(min>a){
			min=a;
		}
		if(max<a){
			max=a;
		}
	}
	
	printf("%d %d %ld\n",min,max,sum);
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <set>
#include <deque>
#include <map>
#include <bitset>
#include <functional>
#include <cmath>

#define INF 10000000000
using namespace std;

const long long MOD = 998244353;

int main() {
    long long n, s;
    cin >> n >> s;
    vector<long long> a(n);
    long long f[3010] = {0};

    for(long long i = 0; i < 3010; i++) f[i] = 0;

    for(long long i = 0; i < n; i++){
        cin >> a[i];
    }

    long long ans = 0;
    for(long long i = 0; i < n; i++){
        for(long long j = s; j >= a[i]; j--){
            f[j] += f[j-a[i]];
            f[j] %= MOD;
        }
        f[a[i]]++;
        f[0]++;
        ans += f[s];
        ans %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
//34
#include<iostream>

using namespace std;

long long pow10(int x){
  long long r=1;
  while(x--){
    r*=10;
  }
  return r;
}

int main(){
  for(long long n;cin>>n,n;){
    int f=((n>0)?1:-1);
    n*=f;
    long long r=0;
    for(int i=0;n;n/=10,i++){
      int m=n%10;
      if((f==1&&i%2==0)||(f==-1&&i%2)){
	r+=m*pow10(i);
      }else if(m){
	r+=(10-m)*pow10(i);
	n+=10;
      }
    }
    cout<<r<<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
from collections import deque
n = int(input())
li = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        li.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            li.remove(command[1])
        except ValueError:
                pass
    elif command[0] == 'deleteFirst':
        li.popleft()
    else:
        li.pop()
print(*li)

Measured memory_bytes: 71884
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 100000 + 10000;
const int MAXK = 20;
const int MOD = 1000000000 + 7;

int n;
long long v[2], s[MAXN], d[MAXN], rmq[MAXN][MAXK];
int f[MAXN][2];

void init()
{
	for(int i = 1; i <= n; i++)
		rmq[i][0] = d[i];
	for(int j = 1; j < MAXK; j++)
		for(int i = 1; i + (1 << j) - 1 <= n; i++)
			rmq[i][j] = min(rmq[i][j - 1], rmq[i + (1 << (j - 1))][j - 1]);
}

long long query(int l, int r)
{
	int k = log2(r - l + 1);
	return min(rmq[l][k], rmq[r - (1 << k) + 1][k]);
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> v[0] >> v[1];
	for(int i = 1; i <= n; i++)
		cin >> s[i];
	for(int i = 1; i <= n; i++)
		d[i] = s[i] - s[i - 1];
	init();
	f[n][0] = f[n][1] = 1;
	for(int i = n - 1; i >= 1; i--)
		for(int j = 0; j <= 1; j++)
		{
			int next = lower_bound(s + i, s + n + 1, s[i] + v[j]) - s - 1;
			if(next == i)
				f[i][j] = (f[i + 1][0] + f[i + 1][1]) % MOD;
			else if(next == i + 1 || query(i + 2, next) >= v[j ^ 1])
				f[i][j] = f[next][j ^ 1];
			else
				f[i][j] = 0;
			// cerr << i << ' ' << j << ' ' << f[i][j] << endl;
		}
	int ans = (f[1][0] + f[1][1]) % MOD;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 19968
#include<iostream>
using namespace std;
int main(){
int n,x,min=100000;
  cin>>n>>x;
  int a[n],sum=0;
  for(int i=0;i<n;++i){
     cin>>a[i];
    sum+=a[i];
    if(min>a[i]) min=a[i];
  }
  x=x-sum;
  x=x/min;
  cout<<x+n<<endl;
  return 0;
}
  

Measured memory_bytes: 256
n,a,b=map(int,input().split())
listint=[i for i in range(1,n+1)]
liststr=[str(listint[i]) for i in range(n)]
anssum=[[] for i in range(n)]
def calculate_sum(listint,liststr,k):
  sumnumber=liststr[k-1]
  sumlist=list(sumnumber)
  sumlistint=[int(sumlist[i]) for i in range(len(sumlist))]
  sum=0
  for i in range(len(sumlistint)):
    sum=sum+sumlistint[i]
  return(sum)
for k in range(0,n):
  anssum[k]=[listint[k],calculate_sum(listint,liststr,k+1)]
answer=0
for i in range(0,n):
  if a<=anssum[i][1]<=b:
    answer=answer+anssum[i][0]
print(answer)
    
  

Measured memory_bytes: 5108
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

std::string S;

int main()
{
	in >> S;
	if ((S[0] == S[S.length() - 1] && S.length() % 2 == 0)
		|| (S[0] != S[S.length() - 1] && S.length() % 2 == 1)) out << "First" << std::endl;
	else out << "Second" << std::endl;
	return 0;
}


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

int main() {
	int N, i, count = 0;
	char S[100000];

	scanf("%s", S);

	N = strlen(S);
	for (i = 0; i < N - 1; i++) {
		if (S[i] != S[i + 1]) {
			count = count + 2;
			N = N - 2;
			if (N <= 1) break;
			S[i] = '\0';
			strcat(S, &S[i + 2]);
			if (i == 0) { i--; }
			else { i = i - 2; }
		}
	}

	printf("%d", count);

	return 0;
}

Measured memory_bytes: 256