akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
 
#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12
 
int main(void) {
  while (true) {
    int x, y, s;
    cin >> x >> y >> s;
    if(!x && !y && !s) break;
 
    int ret_x, ret_y, ans = -INF;
    FOR(i, 1, s) {
      int a = i - i * x / (100 + x), b = (s - i) - (s - i) * x / (100 + x);
      ret_x = a * (100 + x) / 100 + b * (100 + x) / 100;
      ret_y = a * (100 + y) / 100 + b * (100 + y) / 100;
      if (ret_x != s)
        continue;
      else
        ans = max(ans, ret_y);
    }
 
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100010;
int main(void)
{
    char s[10];
    cin>>s;
    if((s[2]==s[3])&&(s[4]==s[5]))
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

const int N = 2e5+7;
int dp[N];

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

    int n;
    cin>>n;

    int ans = 0;
    for (int i=1; i<=n; i++) {
        int x;
        cin>>x;
        dp[x] = dp[x-1]+1;
        ans = max(ans, dp[x]);
    }
    cout<<n-ans<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double x;
double r=0,t=0,PI=3.141592653589;
cin>>x;
r = 2 * x * PI;
t = x * x * PI;
cout<<setprecision(6)<<fixed<<t<<" "<<setprecision(6)<<fixed<<r<<endl;
return 0;
}

Measured memory_bytes: 3264
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>

using namespace std;
typedef long long ll;

int main()
{
 	ios_base::sync_with_stdio(0);
 	string s;
 	cin >> s;
 	int d[4];
 	for(int i=0; i<4; i++) {
 		d[i] = s[i]-'0';
 	}
 	
 	for(int m=0; m<8; m++) {
 		int res=d[0];
 		for(int i=0; i<3; i++) {
 			res += d[i+1]*(m&(1<<i) ? -1 : 1);
 		}
 		if(res==7) {
 			cout << d[0];
 			for(int i=0; i<3; i++) {
 				cout << (m&(1<<i) ? '-' : '+') << d[i+1];
 			}
 			cout << "=7";
 			return 0;
 		}
 	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define f(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define len(s) s.size()
#define all(v) v.begin(), v.end()
#define tr(it, v) for (auto &it : v)
#define bit(x) __builtin_popcount(x)
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
    // =================
void impgraph(int n, int m);
void dfs(int u,int par);

const int mod = 1e7;
const int N = 3e5 + 1;

vi g[N];
int a[N];

void solve()
{
    int n, m, ans = 0, k=0;
    cin>>n>>m;
    f(i,0,n+1) {
        ans=0;
        ans+=i*2+(n-i)*4;
        if(ans==m) {
            cout<<"Yes";
            return;
        }
    }
    cout<<"No";
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}

void impgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u,int par)
{
    a[u] = 1;
    for (int v : g[u])
    {
        if (a[v])
            continue;
        dfs(v,0);
    }
}

Measured memory_bytes: 10732
import scala.io.StdIn
import scala.math._

object Main {
  def main(args: Array[String]): Unit = {
    val Array(a: Int, b: Int) = StdIn.readLine.split(" ").map(_.toInt)

    println(if (a == b) 2 * a else max(a, b) * 2 - 1)
  }
}

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

Dic={}
for i in A:
    if Dic.get(i,None)==None:
        Dic[i]=1
    else:
        Dic[i]+=1
total=0
for i,j in Dic.items():
    if i <= j:
        total+=j-i
    else :
        total+=j
print(total)



Measured memory_bytes: 17780
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
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;
}

int main(){
    string s;
    cin >> s;
    reverse(s.begin(),s.end());
    int n = s.size();
    int c = 0;
    vector<int>a(n+1);
    rep(i,n){    
        a[i] = s[i]-'0';
    }
    ll sm = 0;
    rep(i,n+1){
        if(a[i]+c >5||(a[i]+c==5&&a[i+1]>=5)){
            sm += 10-(a[i]+c);
            c = 1;
        }else{
            sm += (a[i]+c);
            c = 0;
        }
    }
    cout << sm << endl;
    return 0;
}

Measured memory_bytes: 5364
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)); //整数型のまま切り上げ演算する
#define PI 3.14159265359
#define MOD 1000000007
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } }

int main(void) {
	string S, T;
	cin >> S >> T;

	map<char, char> substitution_table;
	for (int i = 0; i < S.size(); i++) {
		if (substitution_table[S[i]] != '\0' and substitution_table[S[i]] != T[i]) {
			cout << "No" << endl;
			return 0;
		}
		else {
			substitution_table[S[i]] = T[i];
		}
	}
	
	map<char, char> complete_substitution_table;
	for (auto &kv:substitution_table) {
		if (complete_substitution_table[kv.second] != '\0' and complete_substitution_table[kv.second] != kv.first) {
			cout << "No" << endl;
			return 0;
		}
		else {
			complete_substitution_table[kv.second] = kv.first;
		}
	}
	cout << "Yes" << endl;
	return 0;
}



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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDB pair<db,db>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const int INF = 1000000007;
const ll LINF = 1000000000000000555;
const int N = 550555;
const int L = 21;
const int M = 2155;
const int K = 555;

void solve(){
    ll n;
    cin >> n;

    if (n == 2){
        cout << 1;
        return;
    }

    VLL v;
    for (ll i = 1; i*i <= n; i++){
        if (n % i == 0 && i != 1) v.PB(i);
        if (n % i == 0 && n != i*i) v.PB(n/i);
    }

    set <ll> s;
    ll m = n-1;
    for (ll i = 1; i*i <= m; i++){
        if (m % i == 0){
            if (i != 1) s.insert(i);
            s.insert(m/i);
        }
    }

    for (ll x : v){
        ll n0 = n;
        while (n % x == 0){
            n /= x;
        }
        if ((n - 1) % x == 0) s.insert(x);
        n = n0;
    }

    cout << SZ(s);

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 384
#include <utility>
#include <queue>
#include <string>
#include <stack>
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main (void){
    int n, h, w;
    cin >> n >> h >> w;
    int k = (n - h + 1) * (n - w + 1);
    
    cout <<k << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;++i) cin>>a[i];
  sort(a.begin(), a.end(), greater<int>());
  int alice=0, bob=0;
  for(int i=0;i<N;++i) {
    if(i%2==0) alice+=a[i];
    else bob+=a[i];
  }
  cout<<alice-bob<<endl;
}



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

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

#define pb push_back
#define in ,
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int n, p[100001];

  cin >> n;
  rep(i, 0, n) cin >> p[i];
  int c = 0;

  rep(i, 0, n - 1) {
    if(p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      c++;
    }
  }
  if(p[n - 1] == n) c++;
  cout << c << endl;
}


Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var s = cin.next();
            for (int i = 0; i < s.Length; i++)
            {
                Console.Write("x");
            }
            
            
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

const double cos60 = 0.5;
const double sin60 = 0.86602540;

void
koch(int n, double x1, double y1, double x2, double y2)
{
	/*      p4
	 * p1___/\___p2
	 *    p3  p5
	 */
#define kh(a, b) ((2 * a + b) / 3)
	double x3 = kh(x1, x2), y3 = kh(y1, y2);
	double x5 = kh(x2, x1), y5 = kh(y2, y1);
	double x4 = (x5 - x3) * cos60 - (y5 - y3) * sin60 + x3;
	double y4 = (x5 - x3) * sin60 + (y5 - y3) * cos60 + y3;
#undef kh

	if (n == 0) {
		printf("%.6f %.6f\n", x1, y1);
		return;
	}

	koch(n - 1, x1, y1, x3, y3);
	koch(n - 1, x3, y3, x4, y4);
	koch(n - 1, x4, y4, x5, y5);
	koch(n - 1, x5, y5, x2, y2);
	return;
}

int
main(void)
{
	koch(getchar() - '0', 0.0, 0.0, 100.0, 0.0);
	printf("100.0 0.0\n");
	return 0;
}


Measured memory_bytes: 2092
A,B,K = map(int,input().split())

ans = []
x = dict()
for i in range(K):
    c = A+i
    d = B-i
    x[c] = c
    x[d] = d

for idx in x:
    if A <= idx and idx <=B:
        ans.append(idx)

ans.sort()
for i in range(len(ans)):
    print(ans[i])
    

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

int main() {
  int x, y, result=0;
  
  cin >> x;
  cin >> y;
  
  int a[x], b[x];
  
  for(int i=0;i<x;i++) {
    cin >> a[i];
    cin >> b[i];
    
    if(sqrt(pow(a[i], 2) + (pow(b[i], 2))) <=  y) {
      result++;
    }
  }
  
  cout << result << endl;
       
  
  return 0;
}



Measured memory_bytes: 5240
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin >> N;
     vector<int> L(N);
   for (int i = 0; i < N; i++) {
    cin >> L.at(i);
  }
   sort(L.begin(), L.end());
  int S =0;
  for (int i = 0; i < N-1; i++) {
 S += L[i]; 
 
}
 
if(L[N-1] < S){
  cout << "Yes" << endl;
}
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int calc(int x, int y, int z) {
    return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, 1, 101) {
        rep(j, 1, 101) {
            rep(k, 1, 101) {
                int sum = calc(i, j, k);
                mp[sum]++;
            }
        }
    }
    rep(i, 1, n + 1) {
        cout << mp[i] << endl;
    }
    return 0;
}


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

int main()
{
  double n, d;

  cin >> n >> d;

  int ans = 0;

  d = 2*d + 1;

  cout << ceil(n / d);
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define mx 1000000007
int main()
{
    int a, b, c;
    cin>>a>>b>>c;
    if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ld long double
#define ll long long
#define st first
#define nd second
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define pb push_back
using namespace std;
const ll mod = 1e9+7;
const int N = 5e5+1;
ll fact[N];
ll inv(ll a, ll p = mod-2) {
	if(p==0) return 1;
	ll b = inv(a, p/2);
	b = b * b % mod;
	if(p%2==0) return b;
	return b * a % mod;
}
ll C(int n, int k) {
	return fact[n] * inv(fact[k] * fact[n-k] % mod) % mod;
}
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n, m;
	ll ans = 0;
	cin>>n>>m;
	fact[0]=1;
	for(int i=1; i<=m; ++i) {
		fact[i] = fact[i-1] * i % mod;
	}
	for(int i=1; i<=n; ++i) {
		ll ways = C(m, n) * fact[n] % mod * C(n, i) % mod * C(m-i, n-i) % mod * fact[n-i] % mod;
		if(i%2==0) ans = (ans - ways + mod)%mod;
		else ans = (ans+ways)%mod;
	}
	ans = (C(m, n) * fact[n] % mod * C(m, n) % mod * fact[n] % mod - ans + mod)%mod;
	cout<<ans;
}


Measured memory_bytes: 7528
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <list>
#include<cstring>
#include<cstdlib>
using namespace std;

int main()
{
	list<int> lst;
	int n,comn;
	char com[20];
	
	//??????????????°??????
	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%s", com);
		scanf("%d", &comn);
		if (com[0] == 'i'){
			lst.push_front(comn);
		}
		//delete???????????????
		else if (com[0] == 'd'){
			if (strlen(com) == 6){
				for (list<int>::iterator it = lst.begin(); it != lst.end(); it++){
					if (*it == comn){
						lst.erase(it);
						break;
					}
				}
			}
			else if (com[6] == 'L'){
				lst.pop_back();
			}
			else if (com[6] == 'F'){
				lst.pop_front();
			}
		}

	}

	if (!lst.empty()){
		list<int>::iterator it = lst.begin();
		printf("%d", *it);
		it++;
		for (it; it != lst.end(); it++){
			printf(" %d", *it);
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 34420
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

int n, s, k;
int ans;

int main(){
    ios::sync_with_stdio(0);
    cin >> n >> s;
    ans = 0;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            k = s-i-j;
            if(k <= n && k >= 0){
                ans++;
            }  
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a, b, c, d;
int main(void){
    // Your code here!
    cin >> a >> b >> c >> d;
    if (a + b < c + d) cout << "Right" << endl;
    else if (a + b == c + d) cout << "Balanced" << endl;
    else cout << "Left" << endl;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if (0 < a) {
        cout << "Positive" << endl;
    }
    else if (a <= 0 && 0 <= b) {
        cout << "Zero" << endl;
    }
    else {
        if (abs(a - b) % 2 == 0) cout << "Negative" << endl;
        else cout << "Positive" << endl;
    }

    return 0;
}


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

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

  bool isFour = false;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    if (s == "Y") {
      isFour = true;
      cout << "Four" << endl;
      break;
    }
  }
  if (!isFour)
    cout << "Three" << endl;
}



Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var N int
	fmt.Scan(&N)
	w := bufio.NewWriter(os.Stdout)
	for n := 1; n <= N; n++ {
		ans := 0
		for x := 1; x <= n; x++ {
			if x*x > n {
				break
			}
			for y := 1; y <= n; y++ {
				if x*x+y*y > n {
					break
				}
				c := n - x*x - y*y - x*y
				if c <= 0 {
					break
				}
				for z := 1; z <= n; z++ {
					tmp := z*z + (y+x)*z
					if tmp > c {
						break
					}
					if tmp == c {
						ans++
					}
				}
			}
		}
		fmt.Fprintln(w, ans)
	}
	w.Flush()
}


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

int main() {
  int K;
  string S;
  cin >> K >> S;
  int l;
  l = S.size();
    
  if (l <= K){
    cout << S << endl;
  }
  else{
    for (int i = 0;i<K; i++){
      char x = S.at(i);
      cout << x;
    }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3616
public class Main {
    public static void main (String[] args)  {

        // ??????????????????????????????.
        // ?????????????????????????????¨??????????????????.
        // ???????????????????????? char ???????????????????´???????.
        java.util.Scanner sc = new java.util.Scanner(System.in);
        String S = sc.nextLine();
        char[] C = S.toCharArray();
        char c = '?';

        // ??§??????????°??????????, ?°????????????§???????????????????????¨?????????.
        // ??¢????????????????????\????????????????????¨?????????.
        for (int i = 0; i < S.length(); i ++) {
            if (Character.isUpperCase(C[i])) { System.out.print(Character.toLowerCase(C[i])); }
            else if (Character.isLowerCase(C[i])) { System.out.print(Character.toUpperCase(C[i])); }
            else { System.out.print(C[i]); }
        }
        System.out.println();
    }
}

Measured memory_bytes: 26996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e7+7;
ll a,b,c,p=0,k=0;
int str[maxn],m[maxn],d[maxn];
void prime()
{
	memset(str,0,sizeof str);
	str[1]=1;
	for(int i=2;i<maxn;i++){
		if(!str[i]){
			m[p++]=i;
			for(int j=i*2;j<=maxn;j+=i){
				str[i]=1;
			}
		}
	}
}
void is_prime(ll n){
	int cnt=0;
	for(int i=0;i<p&&n;i++){
		if(m[i]>n) break;
		if(n%m[i]==0) d[k++]=i;
		while(n%m[i]==0){
			n/=m[i];
		}
	}
	if(n>1){
		d[k++]=n;
	}
}
int main()
{
	prime();
	cin>>a>>b;
	c=__gcd(a,b);
	is_prime(c);
	cout<<++k;
	
	
	
	return 0;
}

Measured memory_bytes: 78592
#include <bits/stdc++.h>
#define ll long long
#define mk make_pair
using namespace std;

const int N = 1e5 + 5;
const int Mod = 1e9 + 7;

char s[N], t[N];
int n, m, q, a[N], b[N];

int main() {
	scanf("%s", s + 1);
	scanf("%s", t + 1);
	n = strlen(s + 1);
	m = strlen(t + 1);
	for (int i = 1; i <= n; i++) {
		if (s[i] == 'A') a[i] = 1;
		else a[i] = 2;
		a[i] += a[i - 1];
		a[i] %= 3;
	}
	for (int i = 1; i <= m; i++) {
		if (t[i] == 'A') b[i] = 1;
		else b[i] = 2;
		b[i] += b[i - 1];
		b[i] %= 3;
	}
	scanf("%d", &q);
	while (q--) {
		int l, r, k, kk;
		scanf("%d %d", &l, &r);
		k = a[r] - a[l - 1];
		k %= 3; k += 3; k %= 3;
		scanf("%d %d", &l, &r);
		kk = b[r] - b[l - 1];
		kk %= 3; kk += 3; kk %= 3;
		if (k == kk) puts("YES");
		else puts("NO"); 
	}
}



Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main(){
    int X; cin >> X;
    int a, b;
    for(int i = -200; i < 200; i++){
        for(int j = -200; j < 200; j++){
            if(pow(i,5)-pow(j,5) == X){
                a = i;
                b = j;
                break;
            }
        }
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 4072
a,b,c,d=map(int,input().split())
x=c-a
y=d-b
s=""
for i in range(y):
  s+="U"
for i in range(x):
  s+="R"
for i in range(y):
  s+="D"
for i in range(x+1):
  s+="L"
for i in range(y+1):
  s+="U"
for i in range(x+1):
  s+="R"
s+="DR"
for i in range(y+1):
  s+="D"
for i in range(x+1):
  s+="L"
s+="U"
print(s)

Measured memory_bytes: 3064
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

a,b = input().split()

A = a * int(b)
B = b * int(a)

if A < B:
    print(A)
else:
    print(B)


Measured memory_bytes: 4332
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	int N;
	cin >> N;
	LL sum=0;
	LL m=1LL<<60;
	for(int i=0;i<N;i++){
		LL a,b;
		cin >> a >> b;
		sum+=b;
		if(a>b){
			m=min(m,b);
		}
	}
	cout << max(sum-m,0LL) << endl;

	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
	ll ans = 0;
	ll t[200005];
	int n;
	ll T;
	cin >> n >> T;
	for(int i = 0; i < n; i++){
		scanf("%lld", &t[i]);	
	}
	for(int i = 0; i < n - 1; i++){
		ans += min(T, t[i + 1] - t[i]);
	}
	ans += T;
	printf("%lld\n", ans);
}

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

using namespace std;
using ll = long long;

int main(void) {
  int n, k;
  cin >> n >> k;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  int tmp = 0;
  int ans = 0;
  for (int i = 0; i < k; i++) {
    tmp += vec[i]; 
  }
  ans = tmp;
  for (int i = k; i < n; i++) {
    tmp = tmp + vec[i] - vec[i - k]; 
    if (ans < tmp) {
      ans = tmp;
    }
  }
  cout << fixed;
  cout << setprecision(12) << (double)((ans + k) / 2.0) << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int a,b;
           cin>>a>>b;
           cout<<(b%a==0 ? a+b:b-a)<<endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;
int a,b,c;
int k1,k2,k3;

int main(){
  cin >> a >> b;
  if(a<9&&b<9) cout << "Yay!" << endl;
  else cout << ":(" << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define NMAX 15005
#define VMAX 200000
#define inf 2000000005

using namespace std;
ifstream f("date.in");
ofstream g("date.out");
int n;
int main()
{
cin>>n;
while(n)
{
    if(n%10==7) {cout<<"Yes";return 0;}
    n=n/10;
}
cout<<"No";

}


Measured memory_bytes: 3636
#include <stdio.h>

int main() {
   
    char input[3];
    int index = 0;
    if ( scanf("%s", input) ) {
        for (int i = 0; i < 3; ++i) {
            char c = input[i];
            if (c == '1') {
                index++;
            }
        }
        printf("%d\n", index);
    }
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;

int main(){
	int N;
	scanf("%d", &N);
	int cost1 = 0, cost2, height1, height2;
	scanf("%d %d", &height1, &height2);
	cost2 = abs(height2 - height1);
	for (int i = 2; i < N; ++i){
		int tmp_height, tmp_cost = cost2;
		scanf("%d", &tmp_height);
		cost2 = min(cost1 + abs(tmp_height - height1), cost2 + abs(tmp_height - height2));
		cost1 = tmp_cost;
		height1 = height2;
		height2 = tmp_height;
	}
	printf("%d\n", cost2);
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import sys


N,X,Y = map(int,input().split())
X -= 1
Y -= 1
#%%
INF =10**9
dist = [[INF]*N for _ in range(N)]


for i in range(N):
    for j in range(i+1,N):
        dist[i][j] = min(j-i, abs(Y-j)+abs(X-i)+1)

ans = [0]*(N-1)
for dst in dist:
    for d in dst:
        if d!=INF:
            ans[d-1] += 1

for a in ans:
    print(a)

Measured memory_bytes: 79196
import Data.List
import Data.Bool

main = putStrLn . unwords . map show . solve =<< getLine

solve :: String -> [Int]
solve = solve' 1

solve' _ [c1,c2] = bool [-1,-1] [1,2] $ c1 == c2
solve' i (c1:s'@(c2:c3:cs)) = bool (solve' (succ i) s') [i,i+2] . (/=3) . length . group $ sort [c1,c2,c3]


Measured memory_bytes: 7548
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

typedef pair<int,int> pii;
const int MAXN  = 2*1e5 + 10;

map < pii , bool > mp;
int N , M , cntA[MAXN] , cntB[MAXN] , rem[MAXN];
vector <int> gr[MAXN] , removed;
string tp;


int main(){
	cin >> N >> M >> tp;
	
	for(int i=0; i<M; i++){
		int u,v; cin >> u >> v;u--;v--;	
		 map< pii , bool >:: iterator it = mp.find(pii(u,v));
		if(it != mp.end()) continue;

		mp[pii(u,v)] = true;
		mp[pii(v,u)] = true;
		gr[u].pb(v);
		gr[v].pb(u);

		if(tp[u] == 'A') 	cntA[v]++;
		else 			cntB[v]++;

		if(tp[v] == 'A') 	cntA[u]++;
		else 			cntB[u]++;		
	}	
	//cout << endl;
	for(int i=0; i<N; i++)
		if(min(cntA[i] , cntB[i]) == 0) rem[i] = 1 , removed.pb(i);



	for(int i=0; i<removed.size(); i++){
	        if(tp[removed[i]] == 'A'){
			for(int j=0; j<gr[removed[i]].size(); j++){
				int cur = gr[removed[i]][j];
				if( (--cntA[cur] == 0) && !rem[cur]) removed.pb(cur) , rem[cur] = 1;	
			}
		}
		else{
			for(int j=0; j<gr[removed[i]].size(); j++){
				int cur = gr[removed[i]][j];
				if( (--cntB[cur] == 0) && !rem[cur]) removed.pb(cur) , rem[cur] = 1;	
			}
		}
	}		

	
	if(removed.size() == N) cout << "No" << '\n';		
	else cout << "Yes" << '\n';
	return 0;
}

Measured memory_bytes: 37504
fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).unwrap();
    // let n: i32 = n.trim().parse().unwrap();

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).expect("error!");
    let v: Vec<i32> = line.split_whitespace().map(|s| s.parse().expect("err")).collect();
    let mut v_s: Vec<i32> = v.clone();
    v_s.sort();

    let mut counter: i32 = 0;
    for (&i, &j) in v.iter().zip(v_s.iter()) {
        if i != j {
            counter += 1;
        }
    }

    if counter == 0 || counter == 2 {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
	char w[110], i = 0, count[2000] = { 0 };
	scanf("%s", w);
	while (w[i] != '\0') {
		count[w[i]]++;
		i++;
	}
	for (int i = 0; i < 26; i++) {
		if (count[w[i]] % 2 == 1) {
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)


int main(void)
{
	int a,b[12],c=0,d=0,i;
	scanf("%d",&a);
	for(i=0;i<a;i++){
		scanf("%d",&b[i]);
		c=c+b[i];
		d=max(d,b[i]);
	}
	if(c-d>d){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

int main() {
    string s;
    cin >> s;
    map<char, int> m;
    for (const char c : s) {
        if (m[c] > 0) {
            cout << "no" << endl;
            return 0;
        }
        m[c]++;
    }
    cout << "yes" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>

#define div1 1000000007

using namespace std;

int main(void)
{
    int N, P[9], Q[9], i, judge=0, ans=0, judge2;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> P[i];
    }

    for(i=1; i<=N; i++){
        cin >> Q[i];
    }

    for(i=1; i<=N; i++){
        if(P[i] > Q[i]){
            judge = 2;
            break;
        }

        if(P[i] < Q[i]){
            judge = 1;
            break;
        }
    }

    if(judge == 0){
        cout << 0 << endl;
    }

    else if(judge == 1){
        while(1){
            judge2 = 0;

            next_permutation(P+1, P+N+1);

            ans++;

            for(i=1; i<=N; i++){
                if(P[i] != Q[i]){
                    judge2 = 1;
                }
            }

            if(judge2 == 0){
                break;
            }
        }

        cout << ans << endl;
    }

    else{
        while(1){
            judge2 = 0;

            next_permutation(Q+1, Q+N+1);

            ans++;

            for(i=1; i<=N; i++){
                if(P[i] != Q[i]){
                    judge2 = 1;
                }
            }

            if(judge2 == 0){
                break;
            }
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 100001
using namespace std;
int main()
{
	int n,counts=0,mins=1000000001;
	cin >> n;
	int a[M];
	long long ans = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		counts += (a[i] < 0) ? 1 : 0;
		mins = min(mins, abs(a[i]));
		ans += abs(a[i]);
	}
	if (counts % 2)
		ans -= 2 * mins;
	cout << ans;
	return 0;
}

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

int main() {
    int N;
    cin >>N;
    double add =0;
    vector<double> data(N);
    for(int i=0; i<N; i++){
        cin >> data.at(i);
        add += 1/data.at(i);
    }
    double ans = 1 / add;
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
     int N,x;
     cin>>N;
     set<int> st;
     while(N--){
         cin>>x;
        if(st.count(x)){
            st.erase(x);
         }else{
            st.insert(x);
        }
     }
     printf("%d",st.size());
     return 0 ;
}

Measured memory_bytes: 4864
N,T=gets.chomp.split(" ").map(&:to_i)
def to_minute(time)
    h,m=time.split(":").map(&:to_i)
    h*60+m
end
ret = []
now = nil
N.times do
    st_time, st_name, ar_time, ar_name=gets.chomp.split(" ")
    st_minute = to_minute(st_time)
    ar_minute = to_minute(ar_time)
    if now != nil && st_minute -now >= T
        ret.push("#{st_name} #{st_minute-now}")
    end
    now = ar_minute
end
puts ret.length
puts ret


Measured memory_bytes: 6880
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;

template <typename T>
struct Edge { int src, dst; T cost;
    Edge(int dst, T cost) : src(-1), dst(dst), cost(cost) { }
    Edge(int src, int dst, T cost) : src(src), dst(dst), cost(cost) { }
};
template <typename T> using Edges = vector<Edge<T>>;
template <typename T> using WeightedGraph = vector<Edges<T>>;
template <typename T> using Matrix = vector<vector<T>>;

template <typename T>
vector<T>  bellman_ford(Edges<T> &edges, int V, int s) {
    const T INF = numeric_limits<T>::max();
    vector<T> dist(V, INF); dist[s] = 0;
    for (int _ = 0; _ < V - 1; _++) {
        for (auto &e: edges) if (dist[e.src] != INF) {
            dist[e.dst] = min(dist[e.dst], dist[e.src] + e.cost);
        }
    }
    for (auto &e: edges) if (dist[e.src] != INF) {
        if (dist[e.src] + e.cost < dist[e.dst]) return {};
    }
    return dist;
}

int main() {
    int V, E, r; cin >> V >> E >> r;
    const auto INF = numeric_limits<int>::max();
    Edges<int> es;
    while (E--) {
        int s, t, d; cin >> s >> t >> d;
        es.emplace_back(s, t, d);
    }
    auto dist = bellman_ford(es, V, r);
    if (dist.empty()) puts("NEGATIVE CYCLE");
    for (int d: dist) {
        if (d == INF) cout << "INF" << endl;
        else cout << d << endl;
    }
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if(i%2==1 && x%2==1) cnt++;
	}
	cout<<cnt;
}

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

// Bit Matrix
const int MAX_ROW = 110; // to be set appropriately
const int MAX_COL = 110000; // to be set appropriately
struct BitMatrix {
    int H, W;
    bitset<MAX_COL> val[MAX_ROW];
    BitMatrix(int m = 1, int n = 1) : H(m), W(n) {}
    inline bitset<MAX_COL>& operator [] (int i) {return val[i];}
};

int main() {
  int N;
  ll ans = 0;
  cin >> N;
  vector<ll> A(N);
//  vector< vector<ll> > B(60, vector<ll>(N+1));
//  vector< bitset<100010> > B(60, bitset<100010>(0));
  BitMatrix B(61, N+1);
  
  ll all_a = 0;
  REP(i, N) {
    ll ain;
    cin >> A[i];
    all_a ^= A[i];
  }
  // 全部XORを取った値で、1 になったbitはどのような分け方をしても、片方は偶数、もう片方は奇数になるので、
  // そのbitは考慮しなくてOK。
  // 最終的に和を求める際に、そのbitは 0+1 か 1+0 にしかならないので、和は 1 になる。
  // つまり、この all_a そのものを足せばいい。
  // 0 になった bit は 偶数と偶数、奇数と奇数 のどちらかになる。
  // 当然、奇数＋奇数になったほうが和は大きいので、それを目指す。

  // 考慮しないbitの情報を消す
  REP(i,N) A[i] &= ~all_a;

  // 考慮しない桁の和は 1 になるので、先に足しておく
  ans = all_a;
  
  // 掃き出し法が使えるように
  //  B[0] = [ A[0].bit59, A[1].bit59,,, A[N-1].bit59, 1 ] 
  //  B[1] = [ A[0].bit58, A[1].bit58,,, A[N-1].bit58, 1 ] 
  // という2次元配列に格納
  REP(i,60) {
    REP(j,N) {
      B[59-i][j] = (A[j] >> i) & 1;
    }
    B[59-i][N] = 1;
  }
  
  // 掃き出し法
  //  ただし、できるだけ上位Bitが1になる解がいいので、上位側から優先して判定する
  //  上記で考慮しないbitにした桁は、対応する行の値が全て 0 になっている。
  //  そのため、pivotに選ばれることはないし、0 なので xor 演算の対象になることもない。
  //  なので、最後まで同じ形 (0 0 0...0 | 1) をしているはず
  vector<bool> use(60,false);
  REP(col,N) {
    int pivot = -1;
    // Pivot探す
    REP(row,60) {
      if (use[row]) continue;
      if (B[row][col] == 1) {
        pivot = row;
        break;
      }
    }
    if (pivot == -1) continue;
    
    // 見つかったpivot以外の行の、現在の列の値を 0 にしていく
    REP(row,60) {
      if ((row != pivot) && (B[row][col] == 1)) {
        B[row] ^= B[pivot];
      }
    }
    use[pivot] = true;
  }

  
  // (0 0 0 0 | 1) となっている桁は無視
  REP(row,60) {
    bool ok = false;
    if ( (B[row][N] == 0) ) ok = true;
    REP(col,N)
      if ( B[row][col] == 1 ) ok = true;
    // 2グループのどちらも 1 になるので、合計値はその桁が 2 になったものになる
    if (ok) 
      ans += (2LL << (59-row));
  }

  cout << ans << endl;
}


Measured memory_bytes: 2560
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
 
    ll a,b,c,d,cn=0;
    cin>>a>>b>>c>>d;
    while(1)
    {
    	if(cn%2==0) 
    	{
    		c -= b;
    	}
    	else
    	{
    		a -= d;
    	}
    	if(c<=0) break;
    	if(a<=0) break;
    	cn++;
    }
    if(c<=0) cout<<"Yes";
    else cout<<"No";

}

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
const ll MOD2 = 998244353;
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; }

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll N; cin >> N;
  string S; cin >> S;
  
  //main
  ll ans = 0;
  for(int i=0; i<N-2; i++){
    if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C'){
      ans ++; 
    }
  }
  
  // output
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), V = cin.getIntArray(N), C = cin.getIntArray(N);
    let VC = new Array(N);
    for (let n = 0; n < N; n++) {
        VC[n] = [V[n], C[n], V[n] - C[n]];
    }
    VC.sort((a, b) => b[2] - a[2]);
    let ans = VC.reduce((ac, v) => ac + (v[2] > 0 ? v[2] : 0), 0);
    console.log(ans);
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21192
#include <stdio.h>
#include <iostream>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

int main() {
    int X, A; cin >> X >> A;
    if (X < A) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
template<class T>inline bool chmax(T& a, T b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T& a, T b){if(a > b){a = b; return 1;}return 0;}
const ll INF = 1LL<<60;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n; cin >> n;
    vector<ll> x(n), y(n);
    REP(i, n){
        cin >> y[i];
        x[i] = y[i];
    }
    sort(ALL(y));
    ll medl = y[n/2 - 1], medr = y[n/2];
    if(medl == medr){
        REP(i, n) cout << medl << endl;
    }
    else{
        REP(i, n){
            if(x[i] <= medl) cout << medr << endl;
            else cout << medl << endl;
        }
    } 
}

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

Measured memory_bytes: 5376
N = int(input())
S = list(map(str,input().split()))
S = list(set(S))
p = S.count("P")
w = S.count("W")
g = S.count("G")
y = S.count("Y")
ans = p+w+g+y
if ans == 3 :
    print("Three")
else :
    print("Four")
    

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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

// fact(n)
int fact(int n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// combination(n,r)
int combination(int n, int r){
	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

int gcd(int a,int b){
	if(!(a % b)) return b;
	return gcd(b,a % b);
}

// lcm(a.b)
int lcm(int a,int b){
	return (a * b) / gcd(a,b);
}

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	nongetpop(array,&(*size));
	return temp;
}

void nongetpop(int *array,int *size){
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
}

int main(int argc, char const *argv[]){
	int n;
	int *a,b[400007];
	int left = 400000 / 2,right = 400000 / 2 + 1;
	scanf("%d",&n);
	a = (int *)malloc(sizeof(int) * n);
	for (int i = 0; i < n; ++i)	scanf(" %d",&a[i]);
	for (int i = 0; i < n; ++i){
		if (i % 2 == (n - 1) % 2)	b[left--] = a[i];
		else	b[right++] = a[i];
	}
	for (int i = left + 1; i < right; ++i)	printf ("%d ",b[i]);
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
using namespace std;

void dec(string& a)
{
	for(int i=0; i<a.size(); i++) {
		if(isdigit(a[i])) {
			a[i] = (a[i] - '0' + 9) % 10 + '0';
		}
	}
}

void inc(string& a)
{
	for(int i=0; i<a.size(); i++) {
		if(isdigit(a[i])) {
			a[i] = (a[i] - '0' + 1) % 10 + '0';
		}
	}
}

void half(string& a)
{
	int N = a.size();
	for(int i=0; i<N/2; i++) swap(a[i], a[N/2+i+N%2]);
}

int main()
{
	int N;
	cin >> N;
	while(N--) {
		string cmd, str;
		cin >> cmd;
		reverse(cmd.begin(), cmd.end());

		cin >> str;
		for(int i=0; i<cmd.size(); i++) {
			if(cmd[i] == 'A') reverse(str.begin(), str.end());
			if(cmd[i] == 'M') inc(str);
			if(cmd[i] == 'P') dec(str);
			if(cmd[i] == 'C') rotate(str.begin(), str.begin() + 1, str.end());
			if(cmd[i] == 'J') rotate(str.begin(), str.end() - 1, str.end());
			if(cmd[i] == 'E') half(str);
		}

		cout << str << endl;
	}


}

Measured memory_bytes: 0