akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

ll nxt()
{
    ll x;
    cin >> x;
    return x;
}

const ll L = 1e5+5;

void solve()
{
    ll n = nxt();

    vector <double> dp(n+1, 0);
    dp[0] = 1;

    for(ll i=0; i<n; i++)
    {
        double p;
        cin >> p;

        for(ll j=i+1; j>=0; j--)
        {
            dp[j] = (j ? dp[j-1] * p : 0) + dp[j] * (1 - p);
        }
    }  

    double ans = 0;

    for(ll i=0; i<=n; i++)
    {
        if(i > n-i)
        {
            ans += dp[i];
        }
    } 

    cout << fixed << setprecision(10) << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll T = 1;
    // T = nxt();

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

    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	a := nextInt()
	s := nextString()

	if a >= 3200 {
		fmt.Println(s)
	} else {
		fmt.Println("red")
	}
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,k,i,j;
	cin>>n>>k;
	if(k>((n-1)*(n-2))/2)
	{
		cout<<-1;
		return 0;
	}
	cout<<(n*(n-1))/2-k<<endl;
	for(i=2;i<=n;i++)
	{
		cout<<1<<" "<<i<<endl;
	}
	for(i=2;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			if(k>0)
			{
				k--;
			}
			else
			{
				cout<<i<<" "<<j<<endl;
			}
		}
	}
	
	return 0;
}

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

internal static class CR
{
    public static string Get() { return Console.ReadLine(); }
    public static IEnumerable<string> GetTexts() { return Console.ReadLine().Split(' '); }
    public static int GetInteger() { return int.Parse(Console.ReadLine()); }
    public static IEnumerable<int> GetIntegers() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)); }
}

namespace AtCoderBeginnerContest
{
    internal class Program
    {
        public static int X { get; private set; }

        private static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.WriteLine(r); }

        private static object GetResult()
        {
            X = CR.GetInteger();

            while (!IsPrime(X))
            {
                X++;
            }

            return X;
        }

        private static bool IsPrime(int x)
        {
            for (int i = x - 1; i > 1; i--)
            {
                if (x % i == 0) return false;
            }

            return true;
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

string s,t,u;

int main(){
	getline(cin,s);
	int cur=0,f=0;
	while(cur<s.size()){
		if(s[cur]!=' '&&s[cur]!='.'&&s[cur]!=','){u=s[cur];t+=u;}
		else{
			if(t.size()>2&&t.size()<7){if(f)cout<<" ";cout<<t;f=1;}
			t="";
		}
		cur++;
	}
	if(t.size()>2&&t.size()<7){if(f)cout<<" ";cout<<t;}
	cout<<endl;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

int main(){
	desperate_optimization(10);
	int A,B;
	cin>>A>>B;
	if(A > 8 || B > 8) cout<<":("<<endl;
	else cout<<"Yay!"<<endl;
	return 0;
}


Measured memory_bytes: 256
//ABC108-B
#include <stdio.h>

int main(){
	int x1, y1, x2, y2, x3, y3, x4, y4, dx, dy;
	scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	dx = x2 - x1;
	dy = y2 - y1;
	x3 = x2 - dy;
	y3 = y2 + dx;
	x4 = x1 - dy;
	y4 = y1 + dx;
	printf("%d %d %d %d\n", x3, y3, x4, y4);
	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

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

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;
  umll A(0);
  ll ans = 0;
  REP(i, 0, N) {
    ll a;
    cin >> a;
    /*
5
2 5 4 3 1
     */
    // 0 1 2 3 4
    // 1 4 3 2 0
    A.emplace(i, a - 1);
    if (A.find(a - 1) != A.end()) {
      if (A[a - 1] == i) {
        ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4388
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    string s;
    cin>>s;
    for (auto it:s) {
        if (it=='1') cout<<'9';
        else if (it=='9') cout<<'1';
        else cout<<it;
    }
}


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

using namespace std;

int main(void) {
	int n;
	string s, t;
	cin >> n >> s >> t;
	if (s == t) {
		cout << n;
		return 0;
	}
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == t[0] && s.size() - i <= t.size()) {
			for (int j = i; j < s.size(); j++) {
				if (s[j] != t[j - i]) {
					break;
				}
				if (j == s.size() - 1) {
					cout << s.size() + t.size() - (s.size() - i);
					return 0;

				}
			}
		}
	}
	cout << s.size() + t.size();
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;


int main() {
	speed;
	string b;
	cin >> b;
	int ans = 0;
	for (int i = 0; i < b.length() + 1; i++) {
		int k = 0;
		int j = i;
		while (b[j]=='A'|| b[j] == 'G' || b[j] == 'C' || b[j] == 'T' ){
			k++;
			j++;
			i = j;
		}
		ans = max(ans, k);
	}
	cout << ans;
	ed;
	return 0;
}


Measured memory_bytes: 256
/**
 * Я слил Atcoder Beginner Contest 172, решив всего две задачи!
 * Я не могу апнуть синего!
 * Я постоянно сливаю раунды, либо не решив тупую задачу, либо набрав штрафа!
 * Я постоянно уступаю всем своим друзьям и знакомым в контестах и нахожу этому оправдания!
 * Я постоянно придумываю сложные неверные решения к простым задачам!
 * -------------------------------------------------------------
 * -Решать сложные задачи
 * -Участвовать в контестах
 * -Делать виртуальные соревнования
 * -------------------------------------------------------------
 * Не уберу это, пока не начну нормально решать задачи, а не заниматься ерундой!!!
**/
  
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
typedef long long  ll;
//typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set
// this for long double
#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<n;j++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define ld long double
#define kek cout<<endl; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
#define halt {cout<<"NO"; return 0;}
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const int N = 1010;
const int INF = 1e8;
const ll LL_INF=1e10;
const ll MOD1=1073741824;
const long double pi=3.1415926535;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
string bin_rep(int n)
{
     string s="";
      for(int i=31;i>=0;i--)
   {
           if(n&(1<<i)) s+='1';
           else s+='0';
   }
   return s;
}
int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
 int h,w;
 cin>>h>>w;
 int k;
 cin>>k;
 char arr[h][w];
 rep(i,0,h) rep(j,0,w) cin>>arr[i][j];
 vector<bool> s(h,0);
 vector<bool> s1(w,0);
           
 int ans=0;
 for(int i=0;i<(1<<h);i++)
 {
           
           for(int j=0;j<h;j++) 
           {
                     if(i&(1<<j)) s[j]=1;
           }
           
           for(int j=0; j<(1<<w); j++) 
           {
               for(int l=0;l<w;l++) if(j&(1<<l)) s1[l]=1;
               int cnt=0;
               rep(l,0,h) rep(l1,0,w)
               {
                     if(s[l] || s1[l1]) continue;
                     if(arr[l][l1]=='#') cnt++;
                     
               }
               rep(l,0,w) s1[l]=0;
               if(cnt==k) ans++;
        }
          rep(l,0,h) s[l]=0;
           
 }
 cout<<ans;
 
 
 
 
 
 
 
 
 
  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
   
 
}

Measured memory_bytes: 3636
class UnionFind():
    def __init__(self,n):
        self.n=n
        self.root=[-1]*n
        self.rank=[-1]*n

    def Find_Root(self,x):
        if self.root[x]<0:return x
        else:
            self.root[x]=self.Find_Root(self.root[x])
            return self.root[x]

    def Unite(self,x,y):
        x=self.Find_Root(x)
        y=self.Find_Root(y)

        if x==y:return
        elif self.rank[x]>self.rank[y]:
            self.root[x] +=self.root[y]
            self.root[y]=x
        else:
            self.root[y] +=self.root[x]
            self.root[x]=y
            if self.rank[x]==self.rank[y]:
                self.rank[y] +=1

    def isSameGroup(self,x,y):
        return self.Find_Root(x)==self.Find_Root(y)

    def size(self,x):
        return -self.root[self.Find_Root(x)]

    def members(self,x):
        root=self.Find_Root(x)
        return [i for i in range(self.n) if self.Find_Root(i)==root]

    def address(self):
        return[i for i,j in enumerate(self.root) if j<0]

    def group_members(self):
        return {i:self.members(i) for i in self.address()}


n,m=map(int,input().split())
P=list(map(int,input().split()))
XY=[list(map(lambda x: int(x)-1,input().split())) for _ in range(m)]

UnionFind=UnionFind(n)
for x,y in XY:
    UnionFind.Unite(x,y)

cnt=0
for num,p in enumerate(P):
    if UnionFind.isSameGroup(num,p-1):
        cnt +=1

print(cnt)

Measured memory_bytes: 34980
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2000;
int a[maxn+5],n,now;
int num[maxn*maxn+5],T;
bitset<maxn*maxn+maxn> S;
int main(){
	scanf("%d",&n),S[0]=1;
	for(int i=1;i<=n;i++){
		scanf("%d",&now);
		S|=S<<now;
	}
	for(int i=1;i<=maxn*maxn;i++) if(S[i]) num[++T]=i;
	printf("%d\n",num[(T+1)>>1]);
	return 0;
}

Measured memory_bytes: 12968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++)cin>>a[i];
  ll ans=0;
  ll now=0;
  for(ll i=1;i<n;i++){
    
    if(now==0){
      now=a[i]-a[i-1];
    }
    else if(now>0){
      if(a[i]<a[i-1]){
        ans++;
        now=0;
      }
    }
    else if(now<0){
      if(a[i]>a[i-1]){
        ans++;
        now=0;
      }
    }
  }
  cout<<ans+1<<endl;
}
          
        
        

Measured memory_bytes: 1024
#include<iostream>
#include<set>
using namespace std;
int main()
{
  long long n,i;
  cin>>n;
  long long m[n];
  for(i=0;i<n;i++)
  {
    cin>>m[i];
  }
  set<int>st;
  for(i=0;i<n;i++)
  {
    st.insert(m[i]);
  }
  if(st.size()==n)
  {
    cout<<"YES"<<endl;
  }
  else
  {
    cout<<"NO"<<endl;
  }
return 0;
}


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

template<class T>
struct SegTree {
  using FX = function<T(T, T)>;
  int n, _n;
  FX fx;
  const T ex;
  vector<T> dat;
  SegTree(int n_, FX fx_, T ex_):fx(fx_), ex(ex_), n(1), _n(n_) {
    while(n < n_) n <<= 1;
    dat.assign((n<<1)-1, ex);
  }
  SegTree(vector<T> &v, FX fx_, T ex_):fx(fx_), ex(ex_), n(1), _n(int(v.size())) {
    int n_ = int(v.size());
    while(n < n_) n <<= 1;
    dat.assign((n<<1)-1, ex);
    copy(v.begin(), v.end(), dat.begin()+n-1);
    for(int i = n-2; i >= 0; i--) dat[i] = fx(dat[chld(i)], dat[chrd(i)]);
  }
  inline int chld(int k) {return (k<<1)+1;}
  inline int chrd(int k) {return (k<<1)+2;}
  void update(int i, T x) {
    i += n-1;
    dat[i] = x;
    while(i) {
      i = (i-1)>>1;
      dat[i] = fx(dat[chld(i)], dat[chrd(i)]);
    }
  }
  inline T query(int a, int b) {return query(a, b, 0, 0, n);}
  T query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return ex;
    if(a <= l && r <= b) return dat[k];
    T vl = query(a, b, chld(k), l, (l+r)>>1);
    T vr = query(a, b, chrd(k), (l+r)>>1, r);
    return fx(vl, vr);
  }
  template<class F>
  int max_right(int l, F f) {
    assert(f(ex));
    if(l == _n) return _n;
    l += n;
    T now = ex;
    do {
      while(~l&1) l >>= 1;
      if(!f(fx(now, dat[l-1]))) {
        while(l < n) {
          l <<= 1;
          if(f(fx(now, dat[l-1]))) {
            now = fx(now, dat[l++ - 1]);
          }
        }
        return l-n;
      }
      now = fx(now, dat[l++ - 1]);
    } while((l & -l) != l);
    return _n;
  }
  template<class F>
  int min_left(int r, F f) {
    assert(f(ex));
    if(r == 0) return 0;
    r += n;
    T now = ex;
    do {
      r--;
      while(r > 1 and r&1) r >>= 1;
      if(!f(fx(dat[r-1], now))) {
        while(r < n) {
          r = chld(r);
          if(f(fx(dat[r-1], now))) {
            now = fx(dat[--r], now);
          }
        }
        return r+1-n;
      }
      now = fx(dat[r-1], now);
    } while((r & -r) != r);
    return 0;
  }
  const T &operator[](int idx) const {return dat[idx+n-1];}
};



int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  vector<int> a(n);
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  SegTree<int> seg(a, [](int i, int j)->int {return max(i, j);}, INT_MIN);
  while(q--) {
    int type, x, y;
    scanf("%d%d%d", &type, &x, &y);
    if(type == 1) {
      seg.update(x-1, y);
    }
    if(type == 2) {
      printf("%d\n", seg.query(x-1, y));
    }
    if(type == 3) {
      printf("%d\n", seg.max_right(x-1, [y](int X)->bool{return X < y;})+1);
    }
  }
}

Measured memory_bytes: 6076
N = int(input())
A = [int(x) for x in input().split()]
count = 0
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0 and A[i] % 5 != 0 :
            count += 1
if count != 0:
    print("DENIED")
else:
    print("APPROVED")
            


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

#define ll long long
#define mod 1000000007
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e17
#define N 100010
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll result(ll a, ll b, ll p){
    ll ans=1;
    if(b==(-1))
        b=p-2;
    while(b){
        if(b&1){
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

ll T,n,m;

int main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll x;
    cin >> n >> m >> x;
    ll c[n];
    ll a[n][m];
    for(int i=0;i<n;i++){
        cin >> c[i];
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    ll ans = inf;
    for(ll i=0;i<(1<<n);i++){
        ll d = i;
        ll p = 0;
        ll cost = 0;
        vector<ll>v(m,0);
        while(d){
            if(d%2){
                for(int j=0;j<m;j++){
                    v[j] += a[p][j];
                }
                cost += c[p];
            }
            d/=2;
            p++;
        }
        ll k=0;
        for(int i=0;i<m;i++){
            if(v[i] < x)
                k = 1;
        }
        if(k==0){
            ans = min(cost, ans);
        }
    }
    if(ans == inf)
        ans = -1;
    cout << ans;
    
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;
const ll MAX_N=1e5;
ll N,M;
vector<ll> G[MAX_N];
bool used[MAX_N];
ll dfs(ll v){
	used[v]=true;
	ll ret=1;
	for(auto e:G[v]){
		if(!used[e]){
			ret+=dfs(e);
		}
	}
	return ret;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N>>M;
	REP(i,M){
		ll a,b;
		cin>>a>>b;
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	ll cnt[2];
	REP(i,2){
		cnt[i]=dfs(i);
	}
	ll bg;
	bg=max_element(cnt,cnt+2)-cnt;
	REP(v,N){
		if(!used[v]){
			ll x=dfs(v);
			cnt[bg]+=x;
		}
	}
	ll ans=0;
	REP(i,2)ans+=cnt[i]*(cnt[i]-1)/2;
	ans-=M;
	cout<<ans<<endl;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<long long int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  for(int i = 0; i < N - 1; i++){
    if(A[i] == A[i + 1]){ cout << "NO"; return 0;}
  }

  cout << "YES";

  return 0;
}





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

int main() {
  long h, w;
  cin >> h >> w;
  long ans;
  if(h == 1 || w == 1) {
    ans = 1;
  } else if ((h * w) % 2 == 0) {
    ans = (h * w) / 2;
  } else {
    ans = (h * w) / 2 + 1;
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
N = int(input())
F = []
for i in range(N):
    A = list(map(int, input().split()))
    F.append(A[::-1])

P = []
for i in range(N):
    A = list(map(int, input().split()))
    P.append(A)

result = float("inf")*(-1)
for i in range(1, 2**10):
    ans = 0
    for l in range(N):
        c = 0
        for j in range(10):
            if ((i>>j) & 1):
                if F[l][j] == 1:
                    c += 1
        ans += P[l][c]
    result = max(ans, result)
print(result)

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


using namespace std ; 

int main ( ) 
{
	char arr1 [18] ; 

	scanf(" %s ", arr1 ) ;
	arr1 [5] = ' ' ;
	arr1 [13] = ' ' ; 
	printf("%s",arr1 ) ;
		return 0 ; 
}

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

using namespace std;

int main(){

int x1,x2,x3,x4;
int y1,y2,y3,y4;
cin >> x1>>y1>>x2>>y2;


x4=x1+(y1-y2);
y4=y1+(x2-x1);




x3=x4+(x2-x1);
y3=y4+(y2-y1);
    cout <<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;

 return 0;
}

Measured memory_bytes: 256
// g++ -std=c++17 -O2 -Wall F.cpp -o F

#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;

int n, a[N], b[N], c[N], d[N];

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

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

    // If a value appers more than (N+1) times in A and B overall,
    // then the answer is No by Pigeonhole Principle.
    for (int i = 0; i <= n; i++) {
        if (c[i] + d[i] > n) {
            cout << "No";
            return 0;
        }
    }

    for (int i = 1; i <= n; i++) {
        c[i] += c[i - 1];
        d[i] += d[i - 1];
    }

    int x = 0;
    for (int i = 1; i <= n; i++) x = max(x, c[i] - d[i - 1]);
    cout << "Yes\n";
    for (int i = 0; i < n; i++) {
        if (i) cout << ' ';
        cout << b[(i + n - x) % n];
    }
}

Measured memory_bytes: 6668
#include <iostream>
#include <algorithm>
#include <vector>
#define VARS int mid = (l + r) / 2, lchild = 2*node + 1, rchild = 2*node + 2

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int MAXN = 100005, INF = (1 << 30);

int N, M;
pii ST[4 * MAXN];
string S;

pii combine ( pii a, pii b )
{
	if ( a.first == b.first )
		return a;
	return (a.first < b.first ? a : b);
}

void build ( int node = 0, int l = 0, int r = N )
{
	if ( l == r )
	{
		ST[node] = {0, l};
		return;
	}
	
	VARS;
	build ( lchild, l, mid );
	build ( rchild, mid + 1, r );
	ST[node] = combine ( ST[lchild], ST[rchild] );
}

void upd ( int pos, int x, int node = 0, int l = 0, int r = N )
{
	if ( pos < l || r < pos )
		return;
	if ( l == r )
	{
		ST[node] = {x, l};
		return;
	}
	
	VARS;
	upd ( pos, x, lchild, l, mid );
	upd ( pos, x, rchild, mid + 1, r );
	ST[node] = combine ( ST[lchild], ST[rchild] );
}

pii qry ( int L, int R, int node = 0, int l = 0, int r = N )
{
	if ( r < L || R < l )
		return {INF, 0};
	if ( L <= l && r <= R )
		return ST[node];
	
	VARS;
	return combine ( qry ( L, R, lchild, l, mid ), qry ( L, R, rchild, mid + 1, r ) );
}

int main ()
{
	cin >> N >> M;
	cin >> S;
	build ( );
	
	pii DP[N + 1];
	DP[N] = {0, N};
	upd ( N, DP[N].first );
	for ( int i = N - 1; i >= 0; i-- )
	{
		if ( S[i] == '1' )
			DP[i] = {INF, -1};
		else
			DP[i] = qry ( i + 1, min ( N, i + M ) );
			
		if ( DP[i].first != INF )
			DP[i].first++;
		upd ( i, DP[i].first );
	}
	
	if ( DP[0].first == INF )
		cout << "-1\n";
	else
	{
		int node = 0;
		while ( DP[node].second != node )
			cout << DP[node].second - node << " ", node = DP[node].second;
		cout << "\n";
	}

	return 0;
}


Measured memory_bytes: 3456
def my_round(x):
  t=str(int(x*10))
  s=len(t)
  if int(t[s-1])>4:
    return int(x)+1
  else:
    return int(x)
N=int(input())
X=list(map(int,input().split()))
ave=sum(X)/N
P=my_round(ave)
ans=0
for y in range(N):
  ans += (X[y]-P)**2
print(ans)

Measured memory_bytes: 9156
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	int B[20][20] = {}; 
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			B[i][j] = -1; 
		}
	}
	for(int i = 0; i < N; i++){
		int n; cin >> n; 
		for(int j = 0; j < n; j++){
			int x, y; cin >> x >> y; 
			x--; 
			B[i][x] = y; // 1は正直者
		}
	}
	int ans = 0; 
	for(int i = 0; i < (1 << N); i++){
		bool ok = 1; 
		for(int j = 0; j < N; j++){
			if(((i >> j) & 1) == 0) continue; 
			for(int k = 0; k < N; k++){
				if(B[j][k] == -1) continue; 
				if(B[j][k] == 1 && (((i >> k) & 1) == 0)) ok = false;
				if(B[j][k] == 0 && (((i >> k) & 1) == 1)) ok = false;
			}
		}
		if(!ok) continue; 
		int cnt = 0; 
		for(int j = 0; j < N; j++){
			if((i >> j) & 1) cnt ++; 
		}
		ans = max(ans, cnt); 	
	}
	cout << ans << endl; 
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc068/tasks/abc068_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    cout << "ABC" << n << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
def slove(n, k):
    a_list = [int(i) for i in k.split()]
    num = len([i for i in a_list if i % 4 == 0])
    tmp =  [i for i in a_list if i % 4 != 0]
    num2 = len([i for i in tmp if i % 2 == 0]) // 2
    return "Yes" if (num + num2)>= n // 2 else "No"

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    k = input()
    print(slove(n, k))


Measured memory_bytes: 15136
let (cnt: int ref) = ref 0

let insertion_sort (n:int) (gap:int) (a:int array) =
  for i=gap to n-1 do
    let (v:int) = a.(i) in
    let (j:int ref) = ref (i - gap) in
    while !j >= 0 && a.(!j) > v do
      a.(!j+gap) <- a.(!j);
      j := !j - gap;
      incr cnt;
    done;
    a.(!j+gap) <- v
  done

let gen_gaps (n:int) =
  let rec aux (l:int list) = match l with
      [] -> aux [1]
    | h::t when h > n -> t
    | h::_ as l -> aux ((float_of_int h |> ( *. ) 2.25 |> int_of_float) ::l) in
  (if n > 701 then aux [701;301;132;57;23;10;4;1]
   else List.filter ((>=) n) [701;301;132;57;23;10;4;1])
  |> Array.of_list

let shell_sort (array:int array) (n: int) =
  let (g:int array) = gen_gaps n in
  let (m:int) = Array.length g in
  for i=0 to m-1 do
    insertion_sort n g.(i) array;
  done;
  Printf.printf "%d\n" m;
  Array.iteri
    (fun i x -> Printf.printf (if i=m-1 then "%d\n" else "%d ") x)
    g;
  Printf.printf "%d\n" !cnt;
  array

let () =
  let (n:int) = read_int () in
  let (a:int array) = (Array.make n 0) in
  for i=0 to n-1 do
    a.(i) <- (read_int ())
  done;
  Array.iter (Printf.printf "%d\n") (shell_sort a n)

Measured memory_bytes: 12308
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        List<(int, long)>[] graph = Enumerable.Repeat(0, n).Select(_ => new List<(int, long)>()).ToArray();
        for (int i = 0; i < n - 1; i++)
        {
            var stc = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
            graph[stc[0]].Add((stc[1], stc[2] + 1));;
            graph[stc[1]].Add((stc[0], stc[2] + 1));
        }

        var qk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var q = qk[0];
        var k = qk[1] - 1;
        long[] dists = Enumerable.Repeat(-1L, n).ToArray();
        Stack<int> stack = new Stack<int>();
        stack.Push(k);
        dists[k] = 0;
        while (stack.Count > 0)
        {
            var elem = stack.Pop();

            foreach (var (id, cost) in graph[elem])
            {
                if (dists[id] != -1) continue;
                dists[id] = dists[elem] + cost;
                stack.Push(id);
            }
        }

        for (int i = 0; i < q; i++)
        {
            var xy = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
            Console.WriteLine(dists[xy[0]] + dists[xy[1]]);
        }
    }
}

Measured memory_bytes: 63576
import numpy as np
import math as m

def main(**kwargs):
    A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

    res = A[k-1]
    return res

if __name__ == "__main__":
    cin = np.array(input().split(" ")).astype("int")
    k, *_ = cin

    cout = main(k=k)
    print(cout)

Measured memory_bytes: 21220
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	int n;
	cin >> n;
	map<string, int> total;
	for (int i = 0; i < n; i++)
	{
		string S;
		cin >> S;
		total[S]++;
	}
	int m;
	cin >> m;
	for (int i = 0; i < m; i++)
	{
		string T;
		cin >> T;
		total[T]--;
	}

	int ans = 0;
	for (auto p : total)
		ans = max(ans, p.second);
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;


void sub_main(istream &is) {
    ll N;
    is >> N;
    if(!is) return;
    vector<ll> A, B;
    for (int i = 0; i < N + 1; ++i) {
        ll a;
        is >> a;
        A.push_back(a);
    } // end i
    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        ll b;
        is >> b;
        ans += min(A[i], b);
        b = max(ll(0), b - A[i]);
        ans += min(A[i+1], b);
        A[i+1] = max(ll(0), A[i+1] - b);
    } // end i
    cout << ans << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_C.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<int> a(n, 0);
  rep(i, m) {
    int l, r;
    cin >> l >> r;
    l--;
    a[l] += 1;
    if(r<n)
    a[r] -= 1;
  }
  repz(i, 1, n) { a[i] += a[i - 1]; }
  int res = 0;
  rep(i, n) res += a[i] == m;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

//cout << fixed << setprecision(10);//
//最小公倍数//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//逆元mod(mを法とするaの逆元)//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//nが大

ll com(ll n,ll m){
	if(n<=0 || m<=0 || n==m){
		return 1;
	}
	if(n<m){
		return 0;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}

	return k;
}


////////////////////////////////////////////////////////////////////




int main() {
int h,w;
cin>>h>>w;

int gr[h+1][w+1];

for(int i=1;i<=h;i++){
	for(int j=1;j<=w;j++){

		cin>>gr[i][j];
	}
}

int cnt=1;

int x[250005][5];


for(int j=1;j<=4;j++){
for(int i=1;i<=250003;i++){
x[i][j]=0;
}
}

for(int i=1;i<=h;i++){
	for(int j=1;j<=w-1;j++){
		if(gr[i][j]%2==1){
gr[i][j]--;
gr[i][j+1]++;
x[cnt][1]=i;
x[cnt][2]=j;
x[cnt][3]=i;
x[cnt][4]=j+1;
cnt++;
		}
	}
	
}


for(int i=1;i<=h-1;i++){
	if(gr[i][w]%2==1){
		gr[i][w]--;
		gr[i+1][w]++;
		x[cnt][1]=i;
x[cnt][2]=w;
x[cnt][3]=i+1;
x[cnt][4]=w;
cnt++;
	}
}

cout<<cnt-1<<endl;
for(int i=1;i<=cnt-1;i++){
	cout<<x[i][1]<<" "<<x[i][2]<<" "<<x[i][3]<<" "<<x[i][4]<<endl;
}

return 0;
}


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

def unko(x):
    ans = 0
    po = 1
    for i in range(64):
        a = x % (po << 1)
        if (a >= po and a % 2 == 0) or (po == 1 and ((x + 1) // 2) % 2 == 1):
            ans = ans | po
        po = po << 1
    return ans

print(unko(A - 1) ^ unko(B))

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	double x1, y1;
	double x2, y2;
	double x3, y3;
	double x4, y4;
	int n;
	int i;
	double a1, a2;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		
		/*
		y = ax
		a = y / x
		*/
		
		a1 = (y2 - y1) / (x2 - x1);
		a2 = (y4 - y3) / (x4 - x3);
		
		if (a1 == a2){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 620
#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
    int a , b ,c , k;
    scanf("%d%d%d%d",&a ,&b , &c , &k);
    int sum = 0;
    if(k <= a) sum = k;
    else if(k > a){
        sum = a;
        if(k > a + b) sum -= k - (a + b);
    }
    printf("%d\n",sum);
} 

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> H(N),t(N),count(N);
  
  for(int i=0;i < N;i++) {
    cin >> H[i];
  }
  
  for(int i=0;i < M;i++) {
    int a,b;
    cin >> a >> b;
    t[a-1]++;
    t[b-1]++;
    
    if(H[a-1] > H[b-1]) {
      count[a-1]++;
    }
    if(H[a-1] < H[b-1]) {
      count[b-1]++;
    }
  }
  
  int ans = 0;
  
  for(int i=0;i < N;i++) {
    if(t[i]==count[i]) 
      ans++;
  }
  
  cout << ans << endl;
}
      
  
  

Measured memory_bytes: 4560
#include<bits/stdc++.h>
#define  ll  long long int
#define  sz  200010

using namespace std;

ll num[sz];
ll mn=LONG_LONG_MAX;

int main()
{

    ll n,i,j,k,c,s,d,p,m,x,y,a,b;

    cin>>n;

    for(i=1;i<=n;i++)
    {
        cin>>a;
        c=0;

        while(a%2==0)
        {
            a=a/2;
            c++;
        }

        mn=min(mn,c);

    }

    cout<<mn<<endl;


    return 0;
}


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

using namespace std;
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    string ans[4];
    ans[0] = "SS";
    ans[1] = "SW";
    ans[2] = "WS";
    ans[3] = "WW";
    for(int i = 0; i <= 3; i++){
        for(int j = 2; j <= n - 1; j++){
            int checker = 1;
            if(ans[i][j - 1] == 'W'){
                checker = -checker;
            }
            if(ans[i][j - 2] == 'W'){
                checker = -checker;
            }
            if(s[j - 1] == 'x'){
                checker = -checker;
            }
            if(checker == 1){
                ans[i].push_back('S');
            } else {
                ans[i].push_back('W');
            }
        }
        int checker2 = 1;
        if(ans[i][n - 2] == 'W'){
            checker2 = -checker2;
        }
        if(ans[i][n - 1] == 'W'){
            checker2 = -checker2;
        }
        if(s[n - 1] == 'x'){
            checker2 = -checker2;
        }
        if(checker2 == 1){
            if(ans[i][0] != 'S'){
                continue;
            }
        }else {
            if(ans[i][0] != 'W'){
                continue;
            }
        }
        checker2 = 1;
        if(ans[i][n - 1] == 'W'){
            checker2 = -checker2;
        }
        if(ans[i][0] == 'W'){
            checker2 = -checker2;
        }
        if(s[0] == 'x'){
            checker2 = -checker2;
        }
        if(checker2 == 1){
            if(ans[i][1] != 'S'){
                continue;
            }
        }else {
            if(ans[i][1] != 'W'){
                continue;
            }
        }
        for(int j = 0; j < n; j++){
            cout << ans[i][j];
        }
        cout << endl;
        return 0;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

#define MAX 10000
 
int main(){
    int n,num;
     
    while(cin >> n,n){
        int array[MAX]={0};
        for(int i = 0 ; i < n ; i++){
            cin >> num;
            array[num] = 1;
        }
         
        int s,g,flg = 0,t = 0 ,cnt = 0;
        for(int i = 1 ; i < MAX ; i++){
            if(array[i]){
                if(!t){
                    s = i;
                    t++;
                }
                g = i;
                cnt++;
            }
            else{
                if(cnt==1){
                    cnt = 0;
                    if(t&&!flg){
                        cout << s;
                        flg++;
                        t = 0;
                    }
                    else if(t&&flg){
                        cout << ' ' << s;
                        t = 0;
                    }
                }
                else{
                    cnt = 0;
                    if(t&&!flg){
                        cout << s << '-' << g;
                        flg++;
                        t = 0;
                    }
                    else if(t&&flg){
                        cout << ' ' << s << '-' << g;
                        t = 0;
                    }
                    else continue;
                }
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int x;cin>>x;
    int r=x/100, q=x%100;
    if(5*r>=q)co(1);
    else co(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[30];
int main()
{
	int n, m;
	cin >> n >> m;
	long long i, j;
	for(i=0; i<m; i++) cin >> a[i];
	for(i=0; i<(1 << m); i++)
	{
		long long x = 0;
		for(j=0; j<m; j++)
		{
			if(i & (1 << j)) x += (1 << a[j]);
		}
		cout << x << ":";
		for(j=0; j<m; j++)
		{
			if(i & (1 << j)) cout << " " << a[j];
		}
		cout << endl;
	}
	return 0;
}


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

vector<int> pre,in,post;
int id;

void rec(int l,int r){
    if(l<r){
    int root=pre[id++];
    int m=distance(in.begin(),find(in.begin(),in.end(),root));
    rec(l,m);
    rec(m+1,r);
    post.push_back(root);
    }
    return;
}

void solve(){
    id=0;
    rec(0,pre.size());
    rep(i,pre.size()){
        if(i!=0)printf(" ");
        printf("%d",post[i]);
    }
    printf("\n");
    return;
}

int main(){
    int n,key;cin>>n;
    rep(i,n){
        scanf("%d",&key);
        pre.push_back(key);
    }
    rep(i,n){
        scanf("%d",&key);
        in.push_back(key);
    }
    solve();
    return 0;
}


Measured memory_bytes: 3304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }

int main() {
  ull n, m;
  vector<ull> a;
  vector<ull> b;
  vector<tuple<ull, ull>> ab;
  cin >> n >> m;

  each(i, n) {
    ull tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    ab.push(make_tuple(tmp1, tmp2));
    a.push(tmp1);
    b.push(tmp2);
  }

  sort(ab.begin(), ab.end(), [](const tuple<ull, ull>& l, const tuple<ull, ull>& r) {
      if (get<0>(l) < get<0>(r)) {
        return true;

        /*
        if (get<1>(l) < get<1>(r)) {
          return true;
        } else {
          return false;
        }
        */

      } else {
        return false;
      }
  });

  ull count = 0;
  ull result = 0;
  for (auto v : ab) {
    auto a = get<0>(v);
    auto b = get<1>(v);
    ull current = 0;
    auto finished = false;
    if ((count + b) <= m) {
      current = b;
    } else {
      current = (m - count);
    }
    count += current;
    result += current * a;
    if (finished) {
      break;
    }
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 4724
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define in(n, m) for (ll i=n; i<m;i++)
#define inj(n, m)for (ll j=n; j<m;j++)
#define ink(n, m)for (ll k=n; k<m;k++)
using namespace std;
using ll=long long;
using P =pair<ll, ll>;
const ll INF = 1LL << 60;
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() {
	ll x;
	cin >> x;
	ll I = 0;
	ll y = 100;
	int t = 0;
	while (y < x) {
		y += y / 100;
		t++;
	}

	cout << t << endl;
	return 0;
}


Measured memory_bytes: 3604
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-31 11:23:46
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

template<class T> std::vector<T> divisor(T n) {
  std::vector<T> res;
  for (T i = 1; i * i <= n; ++i) {
    if (n % i == 0){
      res.push_back(i);
      if (i * i != n){
        res.push_back(n / i);
      }
    }
  }
  std::sort(res.begin(), res.end());

  return res;
}

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

  int64 a, b; cin >> a >> b;

  vector<int64> va = divisor(a);
  vector<int64> vb = divisor(b);

  vector<int64> st;

  set_intersection(all(va), all(vb), inserter(st, st.end()));

  auto IsValid = [](int64 n) -> bool {
    if (n == 1) return true;
    for (int64 i = 2; i * i <= n; ++i) {
      if (n % i == 0) return false;
    }
    return true;
  };

  int ans = 0;

  for (auto e : st) {
    if (IsValid(e)) {
      ++ans;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 512