akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

struct Card {char suit, value; };

void BubbleSort(struct Card C[], int N){
    int i, j;
    for (i=0;i<N;i++){
        for (j=N-1; j>=i; j--){
            if (C[j].value < C[j-1].value) swap(C[j], C[j-1]);
        }
    }
}

void SelectionSort(struct Card A[], int N){
    int i, j, minj;
    for (i=0; i<N; i++){
        minj = i;
        for(j=i; j<N; j++){
            if(A[j].value < A[minj].value) minj = j;
        }
        if(minj!=i){
            swap(A[i], A[minj]);
        }
    }
}

void print(struct Card C[], int N){
    for (int i=0; i<N; i++){
        if (i>0) cout << " ";
        cout << C[i].suit << C[i].value;
    }
    cout << endl;
}

int main(void){
    Card C1[36], C2[36];
    int i, N, ch=1;
    cin >> N;
    for(i=0; i<N; i++){
        cin >> C1[i].suit >> C1[i].value;
        C2[i] = C1[i];
    }

    BubbleSort(C1, N);
    SelectionSort(C2, N);

    for(i=0; i<N; i++){
        if(C1[i].suit != C2[i].suit){
            ch=0;
            break;
        }
    }
    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if(ch) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n, c = 1, d = 1, ans = 0;
  cin >> n;
  while (c <= n) {
    if (d & 1) {
      if (c <= n && n < c*10) {
      	ans += n - c + 1;
      } else {
     	ans += c*10 - c; 
      }
    } 
    c *= 10;
    d++;
  }
  
  cout << ans << endl;

}


Measured memory_bytes: 256
import numpy as np

# 整数の入力
n = input()
n = int(n)

# いくつあるかわからないときのスペース区切りの整数の入力
l = input().split()
l = list(map(int,l))

i = 0
count = 0
for i in range(0,n):
    if l[i] < 0:
        count = count + 1

#print(count)
#print(nums)

l = np.abs(l)

if count % 2 == 0:
    #print(l)
    print(sum(l))

else:
    print( sum(l) - 2*min(l) )


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

int main(){
	int n, b, f, r, v;
	int i, j, k;
	int count[4][3][10]={0};
	
	cin >> n;
	
	for(i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		count [b - 1][f - 1][r - 1] += v;
	}
	
	for(i = 0; i < 4; i++){
		for(j = 0; j < 3; j++){
			for(k = 0; k < 10; k++){
				cout << " " << count[i][j][k];
			}
			cout << endl;
		}
		
		if(i < 3){
			cout << "####################" << endl;
		}
	}
	
    return 0;
}

Measured memory_bytes: 3092
def isPrime( x ):
	if 2 == x or 3 == x:
		return True
	if 0 == x%2:
		return False
	i = 3 
	while  i*i <= x:
		if 0 == x%i:
			return False
		i += 1
	return True


n = int( raw_input( ) )

cnt = i = 0
while i < n:
	num = int( raw_input( ) )
	if isPrime( num  ):
		cnt += 1
	i += 1

print( cnt )

Measured memory_bytes: 4212
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        if(a==1 && b==2 || a==2 && b==1)
        {
            cout<<"3"<<endl;
        }
        else if(a==1 && b==3 ||a==3 && b==1)
        {
            cout<<"2"<<endl;
        }
        else if(a==2 && b==3 ||a==3 && b==2)
        {
            cout<<"1"<<endl;
        }
    }
    return 0;
}


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

using namespace std;
using ll = long long;

double rec( int i, int j, const vector<double>& p, vector<vector<double>>& memo )
{
    if ( i == 0 && j == 0 ) return 1.0;
    if ( i == 0 ) return 0.0;
    if ( memo[ i ][ j ] != -1 ) return memo[ i ][ j ];

    double result = 0.0;
    if ( j < i ) result += rec( i - 1, j, p, memo ) * ( 1.0 - p[ i - 1 ] );
    if ( j > 0 ) result += rec( i - 1, j - 1, p, memo ) * p[ i - 1 ];
    return memo[ i ][ j ] = result;
}

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

    vector<double> p( N );
    for ( int i = 0; i < N; ++i ) cin >> p[ i ];

    vector<vector<double>> memo( N + 10, vector<double>( N + 10, -1 ) );
    double result = 0.0f;
    for ( int i = ( N + 1 ) / 2; i <= N; ++i )
    {
        result += rec( N, i, p, memo );
    }
    cout << fixed << setprecision( 10 ) << result << endl;
}

Measured memory_bytes: 71296
#include<bits/stdc++.h>
using namespace std;
#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
int main(){
    int n; string s; cin >> n >> s;
    vector<int> lis(n+1, 0);
    REP(i, 0, n){
        if(s[i] == 'I')
            lis[i+1] = lis[i] + 1;
        else
            lis[i+1] = lis[i] - 1;
    }
    sort(ALL(lis));
    cout << lis[n] << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

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

  vector<int> cnt(N, 0);
  for (int x = 1; x * x <= N; x++) {
    for (int y = 1; y <= N - x * x; y++) {
      for (int z = 1; z <= N - x * x - y * y; z++) {
        int s = x * x + y * y + z * z + x * y + y * z + z * x;
        if (s <= N) {
          cnt[s - 1]++;
        }
      }
    }
  }

  rep(i, N) { cout << cnt[i] << "\n"; }
  return 0;
}

Measured memory_bytes: 3160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static ConsoleReader;

class Program
{
    static void Main(string[] args)
    {
        var n = Read<int>();
        var a = ReadArray<int>(n);
        var set = new HashSet<int>(a);
        var count = 0;

        Array.Sort(a);
        var max = a[^1];
        for (var i = 0; i < a.Length; i++)
        {
            var num = a[i];
            if (set.Contains(num))
            {
                if (i > 0 && a[i] == a[i - 1] || i < a.Length - 1 && a[i] == a[i + 1]) count--;
                count++;
                var toRemove = num;
                while (toRemove <= max)
                {
                    set.Remove(toRemove);
                    toRemove += num;
                }
            }
        }
        Console.WriteLine(count);
    }
}

public static class IntExtentions
{
    public static void Times(this int n, Action<int> action)
    {
        for (var i = 0; i < n; i++)
        {
            action(i);
        }
    }

    public static void Times(this (int n, int m) dimensions, Action<int, int> action)
    {
        var (n, m) = dimensions;
        n.Times(i => m.Times(j => action(i, j)));
    }
}

public static class ConsoleReader
{
    public static T Read<T>()
        where T : IConvertible
    {
        var inputBuffer = new StringBuilder();
        int currChar;

        while ((currChar = Console.Read()) != -1)
        {
            if (!char.IsWhiteSpace((char)currChar))
            {
                inputBuffer.Append((char)currChar);
            }
            else if (inputBuffer.Length != 0)
            {
                break;
            }
        }

        return (T)Convert.ChangeType(inputBuffer.ToString(), typeof(T));
    }

    public static T[] ReadArray<T>(int count)
        where T : IConvertible
    {
        if (count < 0)
        {
            throw new ArgumentOutOfRangeException(nameof(count), $"'{nameof(count)}' must be >= 0");
        }

        var result = new T[count];

        for (var i = 0; i < count; i++)
        {
            result[i] = Read<T>();
        }

        return result;
    }
}

Measured memory_bytes: 44844
#include<iostream>
#include<vector>
#include<numeric>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> s(n);
    for(int i=0;i<n;i++) cin>>s[i];
    long long sum=accumulate(s.begin(),s.end(),0LL);
    sort(s.begin(),s.end());
    if(sum%10!=0) cout<<sum<<endl;
    else{
        for(int i=0;i<n;i++){
            if(s[i]%10!=0){
                cout<<sum-s[i]<<endl;
                return 0;
            }
        }
        cout<<0<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define FORR(I,A,B) for(int I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	//DMC
	ll N,Q;
	string S;
	cin >> N >> S >> Q;
	ll D,M,DM,ans;
	FOR(q,0,Q){
		ll K;
		cin >> K;
		DM = D = M = 0;
		ans = 0;
		FOR(i,0,K){
			if(S[i]=='D'){
				D++;
			}
			if(S[i]=='M'){
				M++;
				DM += D;
			}
			if(S[i]=='C'){
				ans += DM;
			}
		}
		FOR(i,K,N){
			if(S[i-K]=='D'){
				D--;
				DM-=M;
			}
			if(S[i-K]=='M'){
				M--;
			}
			if(S[i]=='D'){
				D++;
			}
			if(S[i]=='M'){
				M++;
				DM += D;
			}
			if(S[i]=='C'){
				ans += DM;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 1948
import os
import sys
import numpy as np

def solve(H, W, S):
    N = H*W
    G = np.empty((N, N), dtype=np.int64)
    G[:] = 9999999
    for h in range(H):
        for w in range(W):
            i = h*W + w
            G[i, i] = 0
            if w < W-1 and S[h][w] == S[h][w+1] == 46:
                G[i, i+1] = G[i+1, i] = 1
            if h < H-1 and S[h][w] == S[h+1][w] == 46:
                G[i, i+W] = G[i+W, i] = 1
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if G[i, j] > G[i, k] + G[k, j]:
                    G[i, j] = G[i, k] + G[k, j]
    # G[G>=9999999] = 0
    G = np.where(G>=9999999, 0, G)

    ans = G.max()
    return ans


# >>> numba compile >>>
numba_config = [
    [solve, "i8(i8,i8,u1[:,:])"],
]
if sys.argv[-1] == "ONLINE_JUDGE":
    from numba import njit
    from numba.pycc import CC
    cc = CC("my_module")
    for func, signature in numba_config:
        vars()[func.__name__] = njit(signature)(func)
        cc.export(func.__name__, signature)(func)
    cc.compile()
    exit()
elif os.name == "posix":
    exec(f"from my_module import {','.join(func.__name__ for func, _ in numba_config)}")
else:
    from numba import njit
    for func, signature in numba_config:
        vars()[func.__name__] = njit(signature, cache=True)(func)
    print("compiled!", file=sys.stderr)
# <<< numba compile <<<


import sys
def main():
    input= sys.stdin.buffer.readline
    H, W = map(int, input().split())
    S = np.array([np.frombuffer(input(), dtype=np.uint8) for _ in range(H)])
    print(solve(H, W, S))

main()


Measured memory_bytes: 29708
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  string s;
  cin >> s;
  int cnt=0;
  rep(i,s.size()){
    if(s[i]=='1')cnt++;
  }
  cout << cnt << endl;
  return 0;     
}


Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from collections import Counter
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    s = Counter(input()).values()
    print('Yes' if s == [2, 2] else 'No')


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29292
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n; i++)
#define all(v) (v).begin(), (v).end()
#define decimal fixed << setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
const int INF = 1e9;
const LL LLINF = 1e16;
const LL mod = 1e9 + 7;

int dp[2][1<<25];

int main(){
    int n, m;
    cin >> n >> m;
    while(n != 0 || m != 0){
        if(n <= 25){
            vector<bitset<510>> bs(n);
            rep(i, n){
                string s;
                cin >> s;
                bs[i] = bitset<510>(s);
            }
            int ans = 0;
            rep(select, 1<<n){
                int tmp = __builtin_popcount(select);
                if(ans >= tmp) continue;
                bitset<510> rem;
                rep(i, n)if(select & 1<<i) rem ^= bs[i];
                if(rem.none()) ans = tmp;
            }
            cout << ans << endl;
        }else{
            rep(i, 2)rep(j,1<<m) dp[i][j] = -INF;
            dp[0][0] = 0;
            rep(i, n){
                int s = 0;
                string t;
                cin >> t;
                rep(j, m){
                    if(t[m-1-j] == '1') s += 1<<j;
                }
                rep(j, 1<<m)if(dp[i%2][j] >= 0){
                    dp[(i+1)%2][j^s] = max(dp[(i+1)%2][j^s], dp[i%2][j]+1);
                    dp[(i+1)%2][j] = max(dp[(i+1)%2][j], dp[i%2][j]);
                }
                //rep(i, 1<<m) cout << dp[0][i] << endl;
                //cout << endl;
                //rep(i, 1<<m) cout << dp[1][i] << endl;
            }
            cout << dp[n%2][0] << endl;
        }

        cin >> n >> m;
    }
}



Measured memory_bytes: 5144
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var XAB = Console.ReadLine().Split(' ').Select(s=>int.Parse(s)).ToArray();
            var diff = XAB[2] - XAB[1];
            var x = XAB[0];
            if (XAB[2] <= x)
            {
                Console.WriteLine("delicious");
                return;
            }
            if (x< diff)
            {
                Console.WriteLine("dangerous");
                return;
            }
                Console.WriteLine("safe");
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  int res_a, res_b;
  
  cin >> a >> b;
  
  res_a = a - (a/2)*2;
  res_b = b - (b/2)*2;
  
  if ((res_a==1) && (res_b==1)) {
    cout << "Odd" << endl;
  } else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[n];

for(int i=0;i<n;i++)
{
	cin>>a[i];
}
sort(a,a+n);
int sum=0;
for(int i=0;i<k;i++)
{
	sum+=a[i];
}
cout<<sum;
return 0;
}

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

const int N=1e3+20;

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

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d%d",&a[i],&b[i]);

	for(int i=0;i<=n-3;i++)
	{
		bool ok=true;
		for(int j=i;j<i+3;j++)
			if(a[j]!=b[j]) ok=false;
		if(ok) return 0 * printf("Yes");
	}
	puts("No");
}

Measured memory_bytes: 3832
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
        int n;
        int a;
        int ans = 0;
        scanf("%d", &n);
        for(int i = 1;i <= n ; i++){
                scanf("%d", &a);
                if(i % 2 == 1 && a % 2 == 1)ans++;
        }
        printf("%d\n", ans);
        return 0;
}


Measured memory_bytes: 1724
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc124_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            int sum = 0;

            for (int i = 0; i < 2; i++)
            {
                if (a > b)
                {
                    //sum += a;
                    sum = sum + a;
                    a = a - 1;
                }
                else
                {
                    //sum += b;
                    sum = sum + b;
                    b = b - 1;
                }
            }
            Console.Write(sum);
            Console.Read();
        }
    }
}


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

int main() {
    int x,n,u,v;
    cin >> x >> n;
    set<int> s1;
    for(int i=0;i<n;i++) {
        cin >> u;
        s1.insert(u);
    }
    u = x-1, v = x+1;
    if(s1.find(x) == s1.end()) {
        cout << x;
        return 0;
    }
    while(1) {
        if(s1.find(u) == s1.end()) {
            cout << u;
            return 0;
        }
        else if(s1.find(v) == s1.end()) {
            cout << v;
            return 0;
        }
        else {
            u--;
            v++;
        }
    }
    return 0;
}

Measured memory_bytes: 3196
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.min;
import static java.lang.System.arraycopy;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		int n = scanInt(), k = scanInt();
		String s = scanString();
		char c[] = new char[2 * n];
		s.getChars(0, n, c, 0);
		for (int i = 0; i < n; i++) {
			c[2 * n - i - 1] = c[i];
		}
		int ss = 0;
		for (int i = 0, j = 1; j < 2 * n && ss + j - i <= n;) {
			char ci = c[i], cj = c[j];
			if (ci == cj) {
				++i;
				++j;
			} else if (ci < cj) {
				i = ss;
				++j;
			} else {
				while (ss + j - i <= n && ss <= i) {
					ss += j - i;
				}
				i = ss;
				j = ss + 1;
			}
		}
		arraycopy(c, ss, c, n, n);
		int cnt = 1;
		for (int i = 1; i < n && c[n + i] == c[n]; i++) {
			++cnt;
		}
		int ocnt = cnt;
		for (int i = 1; i < k && cnt < n; i++) {
			cnt = min(2 * cnt, n);
		}
		for (int i = 0; i < cnt - ocnt; i++) {
			c[n - i - 1] = c[n];
		}
		out.print(new String(c, n - (cnt - ocnt), n));
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=3e5+10;
#define fi first
#define se second
#define pb push_back
int n;
LL a[N];
const LL mod=1e9+7;
int l[70];
int r[70];
int main() {
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i =1;i<=n;i++)cin>>a[i];
    LL ans=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<60;j++){
            if((1ll<<j)&a[i]){
                ans+=(1ll<<j)%mod*r[j]%mod;
                l[j]++;
            }else{
                ans+=(1ll<<j)%mod*l[j]%mod;
                r[j]++;
            }
        }
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2560
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func Abs(x int) int {
  if x < 0 { x = -x }
  return x
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}

type Cards [][]int
func (C Cards) Len() int { return len(C) }
func (C Cards) Less(i, j int) bool {
  if C[i][0] == C[j][0] { return C[i][1] < C[j][1] }
  return C[i][0] < C[j][0]
}
func (C Cards) Swap(i, j int) { C[i], C[j] = C[j], C[i] }

type BinaryIndexedTree []int
func (BIT BinaryIndexedTree) Get(i int) int {
  P := 0
  for idx := i; 0 < idx; idx -= idx & (-idx) {
    P += BIT[idx]
  }
  return P
}
func (BIT *BinaryIndexedTree) Update(i, v int) {
  N := len((*BIT))
  diff := v - BIT.Get(i) + BIT.Get(i - 1)
  for idx := i; idx < N; idx += idx & (-idx) {
    (*BIT)[idx] += diff
  }
}
func (BIT BinaryIndexedTree) Query(l, r int) int {
  return BIT.Get(r) - BIT.Get(l - 1)
}
func InitBIT(N int) BinaryIndexedTree {
  BIT := make([]int, N + 1)
  return BIT
}

func Check(A [][]int) int {
  N := len(A)
  for i := range A {
    for j := i; j < N; j++ {
      if A[i][0] < A[j][0] { break }
      if Abs(A[j][1] - i) % 2 == A[j][2] {
        swp := A[j]
        for k := j; i < k; k-- {
          A[k] = A[k - 1]
        }
        A[i]= swp
        break
      }
    }
    if Abs(A[i][1] - i) % 2 != A[i][2] { return -1 }
  }
  BIT := InitBIT(N)
  cnt := 0
  for _, a := range A {
    cnt += BIT.Query(a[1] + 1, N)
    BIT.Update(a[1] + 1, 1)
  }
  return cnt
}

func Solve() {
  N := NextInt()
  C := make([][]int, 2)
  for i := range C {
    C[i] = NextIntVec()
  }
  ans := -1
  for i := 0; i < 1 << uint(N); i++ {
    k := i
    X := make([][]int, N)
    for j := range X {
      X[j] = []int{C[k % 2][j], j, k % 2}
      k /= 2
    }
    sort.Sort(Cards(X))
    cnt := Check(X)
    if cnt < 0 { continue }
    if ans < 0 { ans = cnt }
    ans = MinInt(cnt, ans)
  }
  Write(ans)
  return
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long
#define f first
#define s second
signed main()
{
    FAST;
    
     int i=0,j=0,k=0,n=0,m=0,count=0,temp=0,z;
    int temp1=0,temp2=0,temp3=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,anss=0,start=0,end=0,r=0,q=0,total=0;
    int maxx=0,minn=0,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,zz=0,d=0,val=0;
    
    cin>>n>>x>>y;
    int a[n];
    
    for(i=0;i<n;i++)
    {
        a[i]=0;
        
    }
    for(i=1;i<n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            temp = j-i;
            temp = min(temp , abs(x-i) + 1 + abs(y-j));
            a[temp] = a[temp]+1;
            
        }
        
    }
    
    for(i=1;i<n;i++)
    {
        cout<<a[i]<<endl;
    }
    
    
        
    
    
    
    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define float long double
#define PB push_back
#define MP make_pair
#define ss second
#define ff first
#define PI 3.14159265
#define fastrack ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int M = 1e9 + 7;

signed main(){
    fastrack;
    int n, m;
    cin >> n >> m;
    int a[n], sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    float x = sum/(4.0*m);
    for(int i = 0; i < n; i++){
        if(a[i] >= x)
            m--;
    }
    if(m <= 0)
        cout << "Yes" << "\n";
    else
        cout << "No" << "\n";
    return 0;
}


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

using namespace std;

int main()
{
  int N, M, R;
  cin >> N >> M >> R;
  vector<int> r(R, 0);
  for (int i = 0; i < R; ++i) {
    cin >> r[i];
    --r[i];
  }

  vector<vector<int>> road(N, vector<int>(N, 0));
  for (int i = 0; i < M; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    --a; --b;
    road[a][b] = road[b][a] = c;
  }

  for (int k = 0; k < N; ++k) {
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < N; ++j) {
        if (road[i][k] == 0 or road[k][j] == 0) continue;
        int c = road[i][k] + road[k][j];
        if (road[i][j] == 0 or c < road[i][j]) road[i][j] = road[j][i] = c;
      }
    }
  }

  sort(r.begin(), r.end());
  int min_cost = 0;
  do {
    int cost = 0;
    bool skip = false;
    for (int i = 1; i < R; ++i) {
      cost += road[r[i-1]][r[i]];
      /*
      int c = road[r[i-1]][r[i]];
      if (c == 0) {
        skip = true;
        break;
      }
      cost += c;
      */
    }
    // if (skip) continue;
    if (min_cost == 0 or min_cost > cost) min_cost = cost;
  } while(next_permutation(r.begin(), r.end()));

  cout << min_cost << endl;

  return 0;
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M;
  cin >> N >> M;
  vector<ll> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  vector<ll> B(M), C(M);
  for (int i = 0; i < M; i++)
  {
    cin >> B[i] >> C[i];
  }
  map<ll, ll, greater<ll>> mp;
  for (int i = 0; i < N; i++)
    mp[A[i]]++;
  for (int i = 0; i < M; i++)
    mp[C[i]] += B[i];
  ll ans = 0;
  ll cnt = 0;
  for (auto itr = mp.begin(); itr != mp.end(); itr++)
  {
    if (cnt > N)
      break;
    if (cnt + itr->second >= N)
    {
      ans += (N - cnt) * itr->first;
      break;
    }
    else
    {
      ans += itr->second * itr->first;
      cnt += itr->second;
    }
  }
  cout << ans << endl;
  return 0;
}

// ある操作でカードを書き変えるのではなくカードが増えたとして上からN枚選びその和が答えになる．ここでmapを考える．キーにカードの取りうる値，バリューにカードの枚数を保持するようなmapをキーの降順になるように並び替える．全体としてカードがN + sigma_{i = 1}^M B_i枚あるイメージ
// 書き換えの要素を含めた全てのカードでソートをして上からN枚とるイメージ


Measured memory_bytes: 15104
def solve():
    N = int(input())
    ans = N / 108 * 100

    if int(int(ans)*1.08) == N:
        print(int(ans))
    elif int(int(ans+1)*1.08) == N:
        print(int(ans+1))
    else:
        print(':(')


if __name__ == '__main__':
    solve()

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

#define ll long long
#define N 1000000007


int main() {

	string s;
	cin>>s;

	int n = s.length();
	vector<vector<int> > dp(n+1, vector<int>(13,0));

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

	for(int i=1;i<=n;i++){
		if(s[i-1]=='?'){
			for(int j=0;j<10;j++){
				for(int k=0;k<13;k++)
					dp[i][(10*k+j)%13] = (dp[i][(10*k+j)%13] + dp[i-1][k])%N;
			}
		}
		else{
			int a = s[i-1]-'0';
			for(int k=0;k<13;k++){
				dp[i][(10*k+a)%13] = (dp[i][(10*k+a)%13] + dp[i-1][k])%N;
			}

		}
	}

	cout<<dp[n][5]<<endl;

	return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int bubblesort(vector<int> &A, int N) {
    int ret = 0;
    bool Flag = true;
    while (Flag) {
        Flag = false;
        for (int i = N-1; i > 0; i--) if (A[i] < A[i-1]) {
            swap(A[i], A[i-1]);
            ret++;
            Flag = true;
        }
    }
    return ret;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    int ans = bubblesort(A, N);
    for (int i = 0; i < N; i++) {
        cout << A[i] << ((i+1==N)?"\n":" ");
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3100
n = int(input())

def luca(n):
    a = [None] * (n+1)
    a[0] = 2
    a[1] = 1
    for i in range(2, n+1):
        a[i] = a[i-1] + a[i-2]
    return a[n]
 
if __name__ == "__main__":
    print(luca(n))

Measured memory_bytes: 3316
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    rep(i,8)s.pop_back();
    cout<<s<<"\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >>s;
  int a;
  for(int i=0;i<s.size();i++){
    if(s.at(i)!=s.at(s.size()-i-1))a++;
  }
  for(int i=0;i<(s.size()-3)/2;i++){
    if(s.at(i)!=s.at((s.size()-3)/2-i))a++;
  }
  for(int i=(s.size()+1)/2;i<s.size();i++){
    if(s.at(i)!=s.at(s.size()-i-1))a++;
  }
   if(a!=0)cout <<"No";
   else cout <<"Yes";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
long long MOD; template<class T> void mod(T &n){MOD=n;}
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

#define MAX 1005
int field[MAX][MAX];  // start -2  空き地 0 障害物 -1
P num[15];
int dist[MAX][MAX];

signed main(){
  int h,w,n;
  cin>>h>>w>>n;
  
  P start;
  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      char ch; cin>>ch;
      if(ch=='S') {start.first=j; start.second=i; field[i][j]=-2;}
      else if(ch=='.') field[i][j]=0;
      else if(ch=='X') field[i][j]=-1;
      else{ num[ch-'0'].first=j; num[ch-'0'].second=i; }
    }
  }
  
  int sum_time=0;
  for(int i=0; i<n; i++){
    int to=i+1;
    P now_where;
    if(!i){
      now_where.first=start.first;
      now_where.second=start.second;
    }else{
      now_where.first=num[i].first;
      now_where.second=num[i].second;
    }
    
    for(int i=0; i<=w; i++) for(int j=0; j<=h; j++) dist[i][j]=INF;
    dist[now_where.first][now_where.second]=0;
    
    int min_dist=INF;
    queue<P> que;
    que.push(mk(now_where.first,now_where.second));
    while(!que.empty()){
      int x=que.front().first; int y=que.front().second; que.pop();
      if(num[to].first==x&&num[to].second==y){
        min_dist=dist[x][y];
        break;
      }
      for(int k=0; k<4; k++){
        int xx=x+dx[k]; int yy=y+dy[k];
        if(xx<1||xx>w||yy<1||yy>h) continue;
        if(field[yy][xx]==-1) continue;
        if(dist[xx][yy]>dist[x][y]+1){
          dist[xx][yy]=dist[x][y]+1;
          que.push(mk(xx,yy));
        }
      }
    }
    
    sum_time+=min_dist;
  }
  
  cout<<sum_time<<en;
}





Measured memory_bytes: 18824
N, K, S = map(int, input().split())
A = []
for i in range(K):
    A.append(S)

p = 1
if S == 10 ** 9:
    p = -1

for i in range(N - K):
    A.append(S + p)

print(' '.join([str(i) for i in A]))

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

int main()
{
    int a, b, c, sum = 0;
    cin >> a >> b;
    vector<int> vec;
    for (int i = 0; i < a; i++) {
        cin >> c;
        vec.push_back(c);
    }
    sort(vec.begin(), vec.end());

    for (int i = 0; i < b; i++) {
        sum += vec.at(i);
    }

    cout << sum << endl;
}

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

using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define mp make_pair
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

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

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }
void out_sequence(vector<ll> &out) { REP(i, out.size()) { cout << out[i]; if (i == out.size() - 1) cout << endl; else cout << " "; } }



int main(void)
{
	cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);

	string s; cin >> s;
	ll K; cin >> K;
	ll pos = 0;
	while (pos < s.size()) {
		cout << s[pos];
		pos += K;
	}

	return 0;
}



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

int main(){
	int a,b;
	std::cin>>a>>b;

	std::vector<int> v(3);

	v[0] = a + b;
	v[1] = a - b;
	v[2] = a * b;

	std::sort(v.begin(), v.end());

	std::cout<<v[2]<<std::endl;
	return 0;
}

Measured memory_bytes: 256
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
line = lines.shift().split(' ')
N = line[0] * 1
M = line[1] * 1
k = []
for(i=0; i<M ; i++) {
    k[i] = lines[i].split(' ').slice(1).map((x) => x * 1)
    arr = new Array(N).fill(0)
    for (j=0;j<k[i].length;j++) {
        arr[N - k[i][j]] = 1
    }
    k[i] = parseInt(arr.join(''),2)
}
p = lines[i].split(' ').map((x) => x * 1)
max = Math.pow(2, N)
cnt = 0
for (i=0; i<max; i++) {
    bool = true
    for(j=0; j<M ; j++) {
        t = (i & k[j]).toString(2)
        c = 0
        for (s = 0; s < t.length; s++) {
            if (t[s] == 1) {
                c++
            }
        }
        bool = bool && (c % 2 == p[j])
    }
    if (bool) cnt++
}

console.log(cnt)



Measured memory_bytes: 7996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"yes":"no");
}
int main() {
  string s;cin>>s;
  set<char> ans;
  for(int i=0;i<s.size();i++){
    ans.insert(s[i]);
  }
  cout<<yesno(ans.size()==s.size())<<endl;
  return 0;
}


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

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

using namespace std;

int main() {

	int  n, cnt = 0;
	bool p = false, w = false, g = false, y = false;
	char arare;
	

	cin >> n;

	REP(i, n) {
		cin >> arare;

		if (arare == 'P'&&p == false) {
			cnt++;
			p = !p;
		}
		else if (arare == 'W'&&w == false) {
			cnt++;
			w = !w;
		}
		else if (arare == 'G'&&g == false) {
			cnt++;
			g = !g;
		}
		else if (arare == 'Y'&&y == false) {
			cnt++;
			y = !y;
		}
	}

	if (cnt == 3)
		cout << "Three" << endl;
	else
		cout << "Four" << endl;

  return 0;
}


Measured memory_bytes: 256
def isStable(inlist, outlist):
	flag = True
	for i in range(0, N):
		for j in range(i+1, N):
			for a in range(0, N):
				for b in range(a+1, N):
					if int(inlist[i][1:]) == int(inlist[j][1:]) and inlist[i] == outlist[b] and inlist[j] == outlist[a]:
						flag = False
						break
				else:
					continue
				break
			else:
				continue
			break
		else:
			continue
		break

	return(flag)
N = int(input())
A = input().split()
B = A[:]
C = A[:]

flag = 1
counter = 0
while flag:
    flag = 0
    for i in reversed(range(1,N)):
        if int(C[i][1:]) < int(C[i-1][1:]):
            C[i], C[i-1] = C[i-1], C[i]
            counter += 1
            flag = 1
print(" ".join(map(str, C)))

if(isStable(A, C)):
	print("Stable")
else:
	print("Not stable")

counter=0
for i in range(N):
	Br = B[i:]
	Brr = [int(Br[j][1:]) for j in range(N-i)]
	num = Brr.index(min(Brr)) 
	if num != 0:
		B[i], B[(i+num)] = B[(i+num)], B[i]
		counter += 1
print(" ".join(map(str,B)))
if(isStable(A, B)):
	print("Stable")
else:
	print("Not stable")

Measured memory_bytes: 7788
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)      //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++) //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)    //repeat from n to 0
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))        //array size
#define SORTD(a) sort(a,a+ASIZE(a),greater<int>()) //sort in descending order for array
#define SORTA(a) sort(a,a+ASIZE(a))                //sort in ascending order for array
#define SORTS(a) sort(a.begin(),a.end())           //sort in ascending order for string type
typedef long long ll;
 
void SCAN(int *a){scanf("%d",a);}                             //scan for type int
void SCAN(int *a,int n){int i;REP(i,n){scanf("%d",&a[i]);}}   //scan for type int array
void SCAN(char *c){scanf(" %c",c);}                           //scan for type char
void SCAN(char *c,int n){int i;REP(i,n){scanf(" %c",&c[i]);}} //scan for type char array
 
const int MOD = 1000000007;
const int INF = 1000000000;
 
int pascalTri(int n,int r){
	int tri[n+1][n+1];
	int i,j;
	REP(i,n+1){REP(j,n+1){tri[i][j]=0;}}
	REP(i,n+1){
		REP(j,n+1){
			if(j>i){break;}
			if(j==0||j==i){tri[i][j]=1;}else{tri[i][j]=(tri[i-1][j-1]%MOD+tri[i-1][j]%MOD)%MOD;}
		}
	}
	return tri[n][r];
}
 
const int DX4[4]= {-1,0,0,1};
const int DY4[4]= {0,-1,1,0};
 
int main(){
	int n;
	int i,j;
 
	SCAN(&n);
 
	int temp;
	REPD(i,n){
		temp=sqrt(i);
		temp*=temp;
		if(i==temp){
			printf("%d\n",i);
			break;
		}
	}
 

	
 
	return 0;
}

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

int main() {
    
    // 1. input.
    
    // 2. output answer.
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            cout << i << 'x' << j << '=' << (i * j) << endl;
        }
    }
    
    return 0;
    
}


Measured memory_bytes: 3104
#include <stdio.h>
 
#define ZERO 0
#define ONE  1
#define TWO	 2
#define THREE 3
 
int main(void) {
  int i;
  int state=ZERO;
  int proc=0;
  char s[5];
  fgets(s, sizeof(s), stdin);
  
  for (i=0; i<3; i++) {
    if (s[i] == 'R') {
      switch(state) {
        case ZERO:
          state = ONE;
          proc = proc<=1 ? 1 : proc;
          break;
        case ONE:
          state = TWO;
          proc = proc<=2 ? 2: proc;
          break;
        case TWO:
          state = THREE;
          proc = proc<=3 ? 3 : proc;
          break;
      }
    }else if (s[i] == 'S') {
      state = ZERO;
    }
  }
    printf("%d", proc);
    return 0;
}

Measured memory_bytes: 1592
import java.util.Scanner;

public class Main {

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

  private Scanner sc;

  private void run() {
    sc = new Scanner(System.in);
    int W = Integer.parseInt(sc.next());
    int H = Integer.parseInt(sc.next());
    int x = Integer.parseInt(sc.next());
    int y = Integer.parseInt(sc.next());

    double ans = (double) W * (double) H / 2;

    int num = 0;
    if (W == x * 2 && H == y * 2) {
      num = 1;
    }

    System.out.println(ans + " " + num);
  }
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; i++)
        cin >> p[i];
    sort(p, p + n);
    int ans = 0;
    for (int i = 0; i < k; i++)
        ans += p[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


char str[200005];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    scanf("%s", str);

    int cntadd=0, cntsub=0;
    vector<int> cnt(n*2+1);
    int i;
    for(i=0; i<n*2; i++) {
        int tmp = (str[i]=='B'? 1: 0);
        if(cnt[i]%2==tmp) {
            cnt[i+1]=cnt[i]-1;
            cntsub++;
            if(cnt[i+1]<0) {
                printf("0\n"); return 0;
            }
        }
        else {
            cnt[i+1]=cnt[i]+1;
            cntadd++;
        }
    }
    if(cntadd!=n || cntsub!=n) {
        printf("0\n"); return 0;
    }

    ll ans=1;
    cntadd=0;
    for(i=1; i<=n*2; i++) {
        if(cnt[i]>cnt[i-1]) {
            ans = ans * (n-cntadd) %MOD;
            cntadd++;
        }
        else {
            ans = ans * cnt[i-1] %MOD;
        }
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1152