akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

class Dice{
    public:
    int a[7];//-,up,flont,right,left,back,down
    void roll(char d);
    void rotate(void);
};

void Dice::rotate(void){
    int tmp;
    tmp=a[2];
    a[2]=a[3];
    a[3]=a[5];
    a[5]=a[4];
    a[4]=tmp;
}

void Dice::roll(char d){
    int tmp;
    if(d=='N'){
        tmp=a[1];
        a[1]=a[2];
        a[2]=a[6];
        a[6]=a[5];
        a[5]=tmp;
    }
    else if(d=='S'){
        tmp=a[1];
        a[1]=a[5];
        a[5]=a[6];
        a[6]=a[2];
        a[2]=tmp;
    }
    else if(d=='W'){
        tmp=a[1];
        a[1]=a[3];
        a[3]=a[6];
        a[6]=a[4];
        a[4]=tmp;
    }
    else if(d=='E'){
        tmp=a[1];
        a[1]=a[4];
        a[4]=a[6];
        a[6]=a[3];
        a[3]=tmp;
    }
}

int main(void){
    int i,n;
    Dice dice;
    
    for(i=1;i<7;i++){
        std::cin>>dice.a[i];
    }
    std::cin>>n;
    
    int u,f;
    bool b;
    for(i=0;i<n;i++){
        std::cin>>u>>f;
        b=0;
        while(dice.a[1]!=u){
            if(b){
                dice.roll('N');
            }
            else{
                if(dice.a[3]==u||dice.a[4]==u)dice.roll('W');
                b=1;
            }
        }
        while(dice.a[2]!=f){
            dice.rotate();
        }
        std::cout<<dice.a[3]<<std::endl;
    }
    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define ll long long int
#include <iostream>
using namespace std;


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

    int x;
    cin>>x;
    if (x==0)
    {
        cout<<"1"<<endl;
    }
    else
    {
        cout << "0" << endl;
    }
    
    

}

Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#define f first
#define s second
using namespace std;

int main()
{
  int N,x,y,w;
  map<pair<int,int>,int> M;
  vector<pair<int,int> > V; 
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>x>>y>>w;
    M[make_pair(x,y)]=w;
    V.push_back(make_pair(x,y));
  }
  int ans=0,sum;
  for(int i=0;i<N;i++){
    sum=M[make_pair(V[i].f,V[i].s)];
    sum+=M[make_pair(V[i].f,V[i].s+1)];
    sum+=M[make_pair(V[i].f+1,V[i].s)];
    sum+=M[make_pair(V[i].f+1,V[i].s+1)];
    ans=max(ans,sum);
    sum=M[make_pair(V[i].f,V[i].s)];
    sum+=M[make_pair(V[i].f,V[i].s-1)];
    sum+=M[make_pair(V[i].f+1,V[i].s)];
    sum+=M[make_pair(V[i].f+1,V[i].s-1)];
    ans=max(ans,sum);
  }
  cout<<ans<<" / 1"<<endl;

  return 0;
}

Measured memory_bytes: 39272
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define mp make_pair
#define pb push_back
#define pf push_fron
#define INF 1e9
typedef long long ll;

#define PI acos(-1)

string grid[110];

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

	for (int i = 0; i < 50; i++) for (int j = 0; j < 100; j++)grid[i] += '.';
	for (int i = 50; i < 100; i++) for (int j = 0; j < 100; j++)grid[i] += '#';

	int i = 0, j = 0;
	while (a != 0) {
		grid[i][j] = '#';

		if (j == 98) {
			j = 0; i += 2;
		}
		else {
			j+=2;
		}
		a--;
	}

	int k = 51, l = 0;
	while (b != 0) {
		grid[k][l] = '.';

		if (l == 98) {
			l = 0; k += 2;
		}
		else {
			l += 2;
		}
		b--;
	}

	cout << 100 << " " << 100 << endl;

	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			cout << grid[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  static class UnFd{
    int[] parent;
    int[] size;
    int forest;
    UnFd(int n){
      parent=new int[n];
      size=new int[n];
      forest=n;
      for(int i=0;i<n;i++){
        parent[i]=i;
        size[i]=1;
      }
    }
    private boolean isRoot(int i){
      return parent[i]==i;
    }
    private int rootOf(int i){
      if(isRoot(i)){
        return i;
      }
      return parent[i]=rootOf(parent[i]);
    }
    public boolean same(int i,int j){
      return rootOf(i)==rootOf(j);
    }
    public void merge(int i,int j){
      i=rootOf(i);
      j=rootOf(j);
      if(i==j){
        return;
      }
      size[Integer.min(i,j)]+=size[Integer.max(i,j)];
      parent[Integer.max(i,j)]=Integer.min(i,j);
      forest--;
    }
    public int sizeOf(int i){
      return size[rootOf(i)];
    }
    public int[] parents(){
      return parent;
    }
    public int forest(){
      return forest;
    }
    public String toString(){
      return Arrays.toString(parent);
    }
  }
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    int k=sc.nextInt();
    UnFd uf=new UnFd(n);
    int[] sub=new int[n];
    for(int i=0;i<m;i++){
      int a=sc.nextInt()-1;
      int b=sc.nextInt()-1;
      sub[a]++;
      sub[b]++;
      uf.merge(a,b);
    }
    System.err.println(uf);
    System.err.println(Arrays.toString(sub));
    for(int i=0;i<k;i++){
      int c=sc.nextInt()-1;
      int d=sc.nextInt()-1;
      if(uf.same(c,d)){
        sub[c]++;
        sub[d]++;
      }
    }
    System.err.println(Arrays.toString(sub));
    for(int i=0;i<n-1;i++){
      System.out.print((uf.sizeOf(i)-sub[i]-1)+" ");
    }
    System.out.println((uf.sizeOf(n-1)-sub[n-1]-1));
  }
}

Measured memory_bytes: 122796
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define int long long

const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    int n,k;
    cin>>n>>k;
    vector <int> a(n);
    rep(i,n)
    cin>>a[i],a[i]--;
    vector <int> good(n);
    vector <int> cycle;
    int now=0;
    while (!good[now]&&k>0)
    {
        k--;
        good[now]=true;
        now=a[now];
    }
    if (k==0)
    {
        cout<<now+1;
        return 0;
    }
    good=vi(n);
    while (!good[now])
    {
        good[now]=true;
        cycle.pb(now);
        now=a[now];
    }
    cout<<cycle[k%((int)(cycle.size()))]+1;





}

Measured memory_bytes: 8156
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

    int N;
    cin >> N;
    int* A = new int[N];

    int M = 0, subM = 0;
    int Mcount = 0;
    rep (i, N)
    {
        cin >> A[i];
        if (M < A[i])
        {
            subM = M;
            M = A[i];
            Mcount = 1;
        }
        else if (M == A[i])
        {
            ++Mcount;
        }
        else
        {
            if (subM < A[i])
            {
                subM = A[i];
            }
        }
    }

    rep (i, N)
    {
        if (A[i] < M)
        {
            cout << M << "\n";
        }
        else if (A[i] == M)
        {
            if (Mcount >= 2)
            {
                cout << M << "\n";
            }
            else
            {
                cout << subM << "\n";
            }
        }
    }

    return 0;
}



Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int A,B,K; cin >> A >> B >> K;
    for(int i=A;i<=B;i++){
        if(i<A+K || i>B-K) cout << i << endl;
    }
}



Measured memory_bytes: 384
n, k = map(int, input().split())

i = 1
temp = 1
a = 0


# count decide
def countt(temp):
    count = 0
    while temp < k:
        temp *= 2
        count += 1
    return count


while i <= n:
    if i < k:
        count = int(countt(i))
        s = (1 / n * ((1 / 2) ** count))
        i += 1
        a += s
        count -= 1
    else:
        a += 1 / n
        i += 1
print(a)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int inf = 999999999;
const double pi = acos(-1);

#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}

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

ull h,w;

ull calc(ull ww,bool flag){
    ull s[3],h2 = h,w2 = w-ww;
    s[0] = h*ww;
    if(flag){
        h2 = h/2;
        s[1] = h2*w2;
        s[2] = (h-h2)*w2;
    }else{
        h2 = w2/2;
        s[1] = h2*h;
        s[2] = (w2-h2)*h;
    }


//cout << s[0] << " " << s[1] << " " << s[2] << endl;
    sort(s,s+3);
    return s[2] - s[0];
}
int main(){
    
    ull ans = inf;
    cin >> h >> w;

    if(w%3 == 0 || h%3 == 0){
        cout << 0 << endl;
        return 0;
    } rep(m,0,2){
        rep(i,1,w){
            
            //ans = min(ans,calc(i,0));
            ans = min(ans,calc(i,1));
        }

        swap(h,w);
    }

	ans=min(ans,(((w+2)/3)-(w/3))*h);
    ans=min(ans,(((h+2)/3)-(h/3))*w);

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a[10],box,i, j;
	for (i = 0; i < 10; i++) {
		cin >> a[i];
	}
	for (i = 0; i < 9; i++) {
		for (j = i + 1; j < 10; j++) {
			if (a[i] < a[j]) {
				box = a[i];
				a[i] = a[j];
				a[j] = box;
			}
		}
	}for (i = 0; i < 3; i++){
		cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>();
    int sum = 0;
    for(int i = 0; i < n; i++){
        list.add(sc.nextInt());
    }

    Collections.sort(list);
    int a = list.get(n-1);
    a = a/2;
    list.set(n-1,a);

    for(int i = 0; i < n; i++){
        sum += list.get(i);
    }
    System.out.println(sum);
    
    
	}
}

Measured memory_bytes: 21844
<?php


fscanf(STDIN, "%d", $n);

for($i=1;$i<=$n;$i++){
    fscanf(STDIN, "%d", $a[$i]);
    for($j=1;$j<=$a[$i];$j++){
        fscanf(STDIN, "%d %d", $temp, $temp1);
        $map[$i][$temp] = $temp1;
    }
}
$ans = 0;
$bit = pow(2,$n);
for($i=1;$i<$bit;$i++){
    $failed = 0;
    for($j=1;$j<=$n;$j++){
        if(($i & pow(2,($j-1))) != 0){
            foreach($map[$j] as $target => $value){
                if($value == 1){
                    if(($i & pow(2,($target-1))) == 0){
                        $failed = 1;
                        break 2;
                    }
                }
                else{
                    if(($i & pow(2,($target-1))) != 0){
                        $failed = 1;
                        break 2;
                    }

                }

            }

        }
    }
    if($failed == 0){
        $ans = max($ans,bitnum($i));
    }
}
echo $ans;
function bitnum($bits){
    $bits = ($bits & 0x55555555) + ($bits >> 1 & 0x55555555);
    $bits = ($bits & 0x33333333) + ($bits >> 2 & 0x33333333);
    $bits = ($bits & 0x0f0f0f0f) + ($bits >> 4 & 0x0f0f0f0f);
    $bits = ($bits & 0x00ff00ff) + ($bits >> 8 & 0x00ff00ff);
    return ($bits & 0x0000ffff) + ($bits >>16 & 0x0000ffff);
}

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

using namespace std;

typedef long long ll;
typedef unsigned int ui;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<pair<int,int>> vp;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<bool>> vbb;
typedef pair<int,int> pi;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define REP(n, x) for(int i = n; i < x; i++)
#define REPN(n, x) for(int i = x; i >= n; i--)
#define REPVS(arr) for(auto &x : arr)
#define REPV(arr) for(auto x : arr)
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(x) printf("%s\n", s.c_str())
#define F first
#define S second

const int INF = INT_MAX;

int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll temp = 7, pos = 1;
    int n;
    si(n);
    if(n % 2 == 0 || n % 5 == 0){
        pi(-1);
        return 0;
    }
    while(temp % n != 0){
        temp %= n;
        temp = temp * 10 + 7;
        pos++;
    }
    pi(pos);
    return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll N, A, B; cin >> N >> A >> B;
	if (N == 1) {
		print((int) (A == B));
	} else {
		print(max(0ll, (B * (N-1) + A) - (A * (N - 1) + B) + 1));
	}
}

Measured memory_bytes: 384
public class Main {

  private static void solve() {
    int n = ni();
    int[] a = na(n);

    int now = 1;
    for (int i = 1; i <= n; i++) {
      now = a[now - 1];
      if (now == 2) {
        System.out.println(i);
        return;
      }
    }
    System.out.println(-1);

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var dict = new Dictionary<int, int>();

            for (var i = 0; i < N; i++)
            {
                var tmp = int.Parse(Console.ReadLine());
                if (dict.ContainsKey(tmp))
                    dict[tmp]++;
                else
                    dict[tmp] = 1;
            }
            var count = dict.Values.Count(c => c % 2 == 1);
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 20316
import sys
x = int(input())
box = [a**5 for a in range(0,200)]
for i in range(200):
    for j in range(200):
        if box[i] - box[j] == x:
            print(i,j)
            sys.exit()
for k in range(200):
    for l in range(200):
        if (-1)*box[k] + box[l] == x:
            print(-(k),-(l))
            sys.exit()
for s in range(200):
    for t in range(200):
        if box[s] + box[t] == x:
            print(s,-(t))
            sys.exit()


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const long MOD=(long)(1e9+7);
vector<int> adj[MAXN];
vector<pair<int,int>> G[MAXN];

Int N,M,K;
Int B,C,H,W;
Int X,Y,Z;
vector<Int> A;

Int ceilS(Int x,Int y){
    return (x+y-1)/y;
}
using D=long double;

Int perform(Int x){
    return (x*(x+1))/2LL;
}

int main()
{
     cin>>N;
     A.resize(N);
     
     for(auto &x:A) cin>>x;
     Int ans=0;
     sort(A.begin(),A.end());
     if(N&1^1){
         Int middleFirst=A[N/2];
         Int middleSecond=A[N/2-1];
            
         ans+=max(0LL,+middleFirst-middleSecond);
     }
    
     cout<<ans<<"\n";
}


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

int n;
int dfs(int pos,int cnt,int a,int bit,vector<int>& tmp){
    int keta=(pos+cnt)%n;
    if(cnt==0){
        if((bit>>cnt)&1) return a;
        else{
            a^=(1<<keta);
            tmp.push_back(a);
            return a;
        }
    }
    else{
        if((bit>>cnt)&1) return dfs(pos,cnt-1,a,bit,tmp);
        else{
            a=dfs(pos,cnt-1,a,bit,tmp);
            a^=(1<<keta);
            tmp.push_back(a);
            a=dfs(pos,cnt-1,a,bit,tmp);         
            return a;
        }
    }
}
void solve(int a,int b,int bit,vector<int> &v){
    if(a==b){
        v.push_back(b);
        return;
    }
    for(int i=0;i<n;i++){
        if(((a^b)>>i)&1){
            bit^=(1<<i);
            for(int j=0;j<n;j++){
                vector<int> tmp;
                tmp.push_back(a);
                int x=dfs(j,n-1,a,bit,tmp);
                if(x!=b){
                    v.insert(v.end(),tmp.begin(),tmp.end());
                    solve(x^(1<<i),b,bit,v);
                    return;
                }
            }
        }
    }
}
int main(){
    int a,b;
    cin>>n>>a>>b;
    if((__builtin_popcount(a^b)&1)==0){
        cout<<"NO"<<endl;
        return 0;
    }
    vector<int> v;
    int bit=0;
    solve(a,b,bit,v);
    cout<<"YES"<<endl;
    for(int i=0;i<(1<<n);i++){
        cout<<v[i]<<((i+1==(1<<n)) ? "\n" : " ");
    }
    return 0;
}

Measured memory_bytes: 1780
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

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

	int n;
	cin >> n;

	int rating;
	vector<int> colors(8);
	int legend = 0;
	for (int i = 0; i < n; ++i) {
		cin >> rating;
		if (rating < 3200) {
			colors[rating / 400] = 1;
		} else {
			++legend;
		}
	}

	int mini = 0;
	for (int i = 0; i < 8; ++i) {
		if (colors[i]) {
			++mini;
		}
	}

	int maxi;
	if (!mini) {
		mini = 1;
		maxi = legend;
	} else {
		maxi = mini + legend;
	}
	

	cout << mini << " " << maxi << "\n";

	return 0;

}

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

int main() {
    string s1, s2 = "CODEFESTIVAL2016";
    cin >> s1;
    int c = 0;
    for (int i = 0; i < s2.length(); ++i) {
        if(s1[i] != s2[i]) c++;
    }
    cout << c << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;

bool compare_by_b(pair<ll,ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main(void){
    ll n,tmp = 0;
    bool flg = false;
    cin >> n;
    vector<pair<ll,ll>> x(n);
    for(int i = 0;i < n;i++){
        ll a,b;
        cin >> a >> b;
        x[i] = make_pair(b,a);
    }
    //sort(x.begin(),x.end(),compare_by_b());
    sort(x.begin(), x.end());
    for(ll i = 0;i < n;i++){
        tmp += x[i].second;
        if(tmp > x[i].first) flg = true;
    }
    if(flg) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

struct UnionFind{
    vector<int> tree;

    UnionFind(int n): tree(n+1, -1) {};

    int root(int i){ return tree[i] < 0 ? i : tree[i] = root(tree[i]); }

    bool unite(int i, int j){
        i = root(i), j = root(j);
        if(i == j) return false;
        tree[i] += tree[j], tree[j] = i;
        return true;
    }

    bool same(int i, int j){ return root(i) == root(j); }

    int size(int i){ return -tree[root(i)]; }
};

signed main(){
	int n, m;
	cin >> n >> m;

	UnionFind uf(n);
	for(int i = 0;i < m;i++){
		int a, b;
		cin >> a >> b;
		a--; b--;
		uf.unite(a, b);
	}

	int ans = 0;
	for(int i = 0;i < n;i++){
		chmax(ans, uf.size(i));
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4952
#pragma GCC optimize ("Ofast")

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING

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


typedef long long ll;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);

	ll n, d;
	cin >> n >> d;
	
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		ll x, y;
		cin >> x >> y;

		if (x * x + y * y <= d * d)
			++cnt;
	}

	cout << cnt << '\n';
	
	return 0;
}

Measured memory_bytes: 3544
using System;
using System.Linq;
using CompLib.Util;
using System.Threading;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        long n = sc.NextLong();
        long x = sc.NextInt();
        long m = sc.NextInt();


        var to = new long[m];
        var sum = new long[m];
        for (int i = 0; i < m; i++)
        {
            sum[i] = i;
            to[i] = ((long)i * i) % m;
        }

        long ans = 0;
        while (n > 0)
        {
            if (n % 2 == 1)
            {
                ans += sum[x];
                x = to[x];
            }
            var nSum = new long[m];
            var next = new long[m];
            for (int i = 0; i < m; i++)
            {
                next[i] = to[to[i]];
                nSum[i] = sum[i] + sum[to[i]];
            }

            to = next;
            sum = nSum;
            n /= 2;
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 57624
#include <iostream>

int main(){
  int n;
  std::cin >> n;
  while(n>0){
    n--;
    int a, b, c;
    std::cin >> a >> b >> c;
    if(a*a+b*b==c*c || a*a+c*c==b*b || b*b+c*c==a*a) std::cout << "YES" << std::endl;
    else std::cout << "NO" << std::endl;
  }
}


Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
  int n,c;
  for(;;){
    scanf("%d",&n);if(!n)break;
    c=0;
    while(n!=1){
      if(n&1)n*=3,n++;
      else n/=2;
      c++;
    }
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 0
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N,K = LI()
s = set()
for i in range(K):
    _ = I()
    s.update(LI())

print(N-len(s))

Measured memory_bytes: 27024
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    string S, T;
    cin >> S >> T;

    vector<int> cntS(26, 0), cntT(26, 0);
    rep(i, S.size()) cntS[S[i] - 'a']++;
    rep(i, T.size()) cntT[T[i] - 'a']++;

    sort(all(cntS));
    sort(all(cntT));

    rep(i, 26) {
        if (cntS[i] != cntT[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 776
#include <iostream>
using namespace std;
int l[100000];
int r[100000];
int acs[100000];
int main(void){
    // Your code here!
    int N;
    int Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    
    for(int i = 0; i < Q; i++){
        cin >> l[i] >> r[i];
    }
    
    acs[0] = 0;
    for(int i = 1; i < S.size(); i++){
        acs[i] = acs[i - 1];
        if(S[i - 1] == 'A' && S[i] == 'C'){
            acs[i] ++;
        }
        //cout << acs[i] << endl;
    }
    
    for(int i = 0; i < Q; i++){
        int ans;
        if(l[i] <= 1){
            ans = acs[r[i] - 1];
        } else {
            ans = acs[r[i] - 1] - acs[l[i] - 2];
            //cout << ans << endl;
            if(S[l[i] - 2] == 'A' && S[l[i] - 1] == 'C'){
                ans --;
            }
        }
        cout << ans << endl;
    }
    
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
signed main(){
  int w,h;
  while(cin>>w>>h,w||h){
    int c[h][w];
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
	cin>>c[i][j];
    int ans=0;
    int ax[]={-1,0,1,-1,1,-1,0,1};
    int ay[]={-1,-1,-1,0,0,1,1,1};
    int used[h][w];
    memset(used,0,sizeof(used));
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(used[i][j]) continue;
	if(!c[i][j]) continue;
	ans++;
	queue<P> q;
	q.push(P(i,j));
	while(!q.empty()){
	  P p=q.front();q.pop();
	  int y=p.first,x=p.second;
	  //cout<<y<<" "<<x<<endl;
	  if(used[y][x]) continue;
	  if(!c[y][x]) continue;
	  used[y][x]=1;
	  for(int k=0;k<8;k++){
	    int ny=y+ay[k],nx=x+ax[k];
	    if(ny<0||ny>=h||nx<0||nx>=w) continue;
	    if(used[ny][nx]) continue;
	    if(!c[ny][nx]) continue;
	    q.push(P(ny,nx));
	  }
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3044
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0;i < N;i++)cin >> A[i];
    sort(A.begin(),A.end());
    A.erase(unique(A.begin(),A.end()),A.end());
    cout << A.size() << endl;
}

Measured memory_bytes: 256
using System;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = int.Parse(Console.ReadLine());
            double ans = 1;

            for(var i = 2; i <= 31; i++)
            {
                var count = 2;
                while (Math.Pow(i, count) <= X)
                {
                    if (Math.Pow(i, count) > ans) ans = Math.Pow(i, count);
                    count++;
                }
                if (ans > X) break;
            }

            Console.WriteLine(ans);
        }
    }
}

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

using namespace std;

int gcd(int a, int b) {
  int mi = min(a,b);
  int ma = max(a,b);
  if (ma % mi == 0) {
    return mi;
  }
  else {
    return gcd(mi, ma%mi);
  }
}

int main(int argc, char const *argv[]) {
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  for (int i=0; i<n; i++) std::cin >> a[i];
  int temp;
  int res = gcd(a[0],a[1]);
  for (int i=1; i<n; i++ ) {
    temp = res;
    res = gcd(temp, a[i]);
  }
  std::cout << res << '\n';
  return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#include <queue>

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;



void solve() {
	int a, b, x;
	cin >> a >> b >> x;



	cout << ((a <= x && x <= a + b) ? "YES" : "NO") << endl;
}


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

	solve(); 
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int a, b, c, d, e, k;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b >> c >> d >> e >> k;
	if(e - a > k) cout << ":(\n";
	else cout << "Yay!\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int n;
    cin >> n;
    vector<int> cnt(100005, 0);
    rep(i,n) {
        int a;
        cin >> a;
        a++;
        cnt[a]++; cnt[a-1]++; cnt[a+1]++;
    }
    int ans = 0;
    rep(i,100005){
        ans = max(ans, cnt[i]);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long int t[1000005];
int main(){
    long long int n,a,b;
    long long int ans=0;
    scanf("%lld%lld%lld",&n,&a,&b);
    for(int i=0;i<n;i++)
        scanf("%lld",&t[i]);
    for(int i=1;i<n;i++)
        ans+=a*(t[i]-t[i-1])>b?b:a*(t[i]-t[i-1]);
    printf("%lld\n",ans);
}

Measured memory_bytes: 1024
import sys
while True:
    sys.setrecursionlimit(10000000)
    w,h=map(int,input().split())
    if w==0 and h==0:
        sys.exit()

    field=[list(map(int,input().split())) for i in range(h)]

    def dfs(x,y):
        if not(0<=x<h) or not(0<=y<w):
            return
        elif field[x][y]==0:
            return
        field[x][y]=0
        for i in range(3):
            for j in range(3):
                dfs(x-1+i,y-1+j)
        return 0
    ans=0
    for i in range(h):
        for j in range(w):
            if field[i][j]==1:
                dfs(i,j)
                ans+=1     
    print(ans)



Measured memory_bytes: 7996
s = input()
t = input()
n_s = len(s)
n_t = len(t)

dp = [[0]*(n_t+1) for _ in range(n_s+1)]
#dp[i][j]はsのi文字目までとtのj文字目までのLCSの長さ

for i in range(n_s+1):
    for j in range(n_t+1):
        if i == 0 or j == 0:
            continue
        dp[i][j] = max(dp[i-1][j], dp[i][j-1])
        if s[i-1] == t[j-1]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-1]+1)

sna = ""
while n_s > 0 and n_t > 0:
    if dp[n_s][n_t] == dp[n_s-1][n_t]:
        n_s -= 1
    elif dp[n_s][n_t] == dp[n_s][n_t-1]:
        n_t -= 1
    else:
        sna += s[n_s-1]
        n_s -= 1
        n_t -= 1
ans = ""
for i in range(len(sna))[::-1]:
    ans += sna[i]
print(ans)

Measured memory_bytes: 138976
#include <iostream>
#define MAX_INT 2147483647
using namespace std;
int Max(int a, int b) {	return a > b ? a : b;};

int main() {

	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	int cost = MAX_INT;

	for (int i = 0; i <= X + Y; i++) {
		int cost_tmp = 2*C*i + A*Max(0, X - i) + B*Max(0, Y - i);
		cost = (cost_tmp < cost) ? cost_tmp : cost;
	}
	cout << cost << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
//const ll MOD = 1000000007;

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

Measured memory_bytes: 256
#include <bits/stdc++.h> 
 
#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007
 
using ll  = long long;
using ull = unsigned long long;
 
int main(int argc, char *argv[])
{
    int N, H, W;
    std::cin >> N >> H >> W;

    std::vector<int> a(N), b(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a[i] >> b[i];
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (a[i] >= H && b[i] >= W) {
            ans++;
        }
    }

    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>

using namespace std;

/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;    
    }
    return sum;
}
/// 最小公倍数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){

int N, Y;
cin >> N >> Y;

int x = -1,y = -1,z = -1;

for(int i = 0; i <= N; i++){
    
    for(int j = 0; j<= N -i; j++){
        
        int k = N - i - j;
        if(10000*k + 5000*j + 1000*i == Y ){
            x = k;
            y = j;
            z = i;
          

        }
    }
}

cout << x << " " << y << " " << z << " "<< endl;

}

Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp

ans= 0
S.split('').each do |char|
  ans += char == '+' ? 1 : -1
end

puts ans


Measured memory_bytes: 14172
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stdio.h>
#include <map>

using namespace std;
int main(void)
{
	char s[15];
	char t[15];
	
	cin >> s;
	
	int j = 0;
	for (int i = 0; i < strlen(s); i++) {
		if (s[i] == 'B') {
			if (j != 0) {
				j--;
				t[j] = '\0';
			}
		}
		else {
			t[j] = s[i];
			j++;
		}
	}
		
	t[j] = '\0';
	
	cout << t << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  int n;
  cin>>n;
  bool flag = false;
  int ans;
  for(int x = 0; x <= 50000; x++){
    double temp = x;
    temp *= 1.08;
    int t = (int)temp;
    if(t == n){
      flag = true;
      ans = x;
      break;
    }
  }
  if(flag){
    cout<<ans<<endl;
  }else{
    cout<<":("<<endl;
  }
  return 0; 
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin>>n;
  long long int temp,x;
  cin>>temp;
  bool flag=0;
  if(temp>0)
  {
    temp--;
  }
  for(int i=1;i<n;i++)
  {
    cin>>x;
    if(x>temp)
    {
      x--;
    }
    if(x<temp)
    {
      cout<<"No";
      flag=1;
      break;
    }
    temp=x;
  }
  if(flag==0)
  {
    cout<<"Yes";
  }
  return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import Data.List
import Data.Array

main :: IO ()
main = do
  n <- readLn
  xs <- replicateM n $ map read . words <$> getLine :: IO [[Int]]
  ys <- replicateM n $ map read . words <$> getLine :: IO [[Int]]
  -- print $ solve xs ys
  print $ solve'' n xs ys

solve'' :: Int -> [[Int]] -> [[Int]] -> Int
solve'' n xs ys = n - (length $ foldl' go blues reds)
  where
    reds = reverse . sortOn last $  xs
    blues = sortOn head $ ys
    go :: [[Int]] -> [Int] -> [[Int]]
    go bs r = deleteBy canBeGoodFriends r bs

canBeGoodFriends :: [Int] -> [Int] -> Bool
canBeGoodFriends (a:b:_) (c:d:_) = a < c && b < d


Measured memory_bytes: 1020
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        System.out.println(z+" "+x+" "+y);
        sc.close();
    }
}

Measured memory_bytes: 22868
import java.util.Scanner;

class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] nums = new int[n];

        long min = 1000000;
        long max = -1000000;
        long sum = 0;

        for (int i = 0; i < nums.length; i++) {
            nums[i] = sc.nextInt();

            if (nums[i] > max) max = nums[i];
            if (nums[i] < min) min = nums[i];
            sum += nums[i];
        }

        System.out.println(min + " " + max + " " + sum);

        sc.close();
    }
}


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int n = in();
  vector<int> a(n), b(n);

  cin >> a >> b;
  int64_t cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (b[i] < a[i]) {
      cnt += 2 * (a[i] - b[i]);
    } else {
      cnt -= (b[i] - a[i]) / 2 * 2;
    }
  }

  if (cnt <= 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define MAX 1000005
#define MOD (ll)(1e9+7)
using namespace std;

int main()	
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	ll ans=0;
	for(int i=0; i<n;)	{
		int x=s[i];
		while(s[i]==x)	{
			i++;
		}
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3672
using System;
using System.Linq;
using System.Collections.Generic;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var sArray = new string[n];
            for (var i = 0; i < n; i++)
            {
                var arr = Console.ReadLine().ToArray();
                Array.Sort(arr);
                sArray[i] = new string(arr);
            }

            long count = 0;
            var groups = sArray.GroupBy(s => s);
            foreach (var group in groups)
            {
                long groupCount = group.Count();
                count += groupCount * (groupCount - 1) / (long)2;
            }

            //出力
            Console.WriteLine(count.ToString());

            //Console.ReadLine();
        }
    }
}

Measured memory_bytes: 35460