akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <cmath>
 
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)

using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v) {
    seen[v] = true; // v を訪問済にする

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
  ll N;
  //ll n[10000010];
  ll y[10000010]={};
  
  cin >> N;
  
  FOR(i, 1, 10000001){
    for (long long j = i; j <= 10000001; j+=i) {
      y[j]++;
    }
  }
  
  ll sum=0;
  rep(i,N) sum += (i+1)*y[i+1];
  
  cout << sum << endl;
  
}

Measured memory_bytes: 81764
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef pair<int, int> P;

/** Problem2101 : Perfect Number **/
int main()
{
	int N;
	while (cin>>N, N) {
		int sum=0;
		sum-=N;
		
		for (int i=1; i*i<=N; i++) {
			if (N%i==0) {
				sum+=i;
				
				if (i != N/i)
					sum+=N/i;
			}
		}
		
		if (sum == N)
			cout << "perfect number" << endl;
		else if (sum < N)
			cout << "deficient number" << endl;
		else
			cout << "abundant number" << endl;
	}
}

Measured memory_bytes: 1156
import java.text.*;
import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        String a = sc.next();//A

        try {
            // 日付1を「A」に設定
            DateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
            Date date1 = sdf.parse(a);
            // 日付2を「2019/4/30」に設定
            Date date2 = sdf.parse("2019/04/30");

            // 2つの日付を比較し、結果によってメッセージを変えます
            int diff = date1.compareTo(date2);
            if (diff > 0) {
                System.out.println("TBD");
            } else {
                System.out.println("Heisei");
            }

        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}


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

int main(void){
  string S;
  cin >> S;
  int count = 0;
  for(int i = 1; i < S.length(); i++){
   if(S[i - 1] == S[i]){
     if(S[i] == '1')S[i] = '0';
     else S[i] = '1';
     count++;
   }
  }
   cout << count; 
  return 0;
  
}

Measured memory_bytes: 512
package main

import "fmt"

type combo struct {
	S, T byte
}

func main() {
	var s, t string
	fmt.Scan(&s, &t)

	combos := make([]combo, 0, 26)

	for i := 0; i < len(s); i++ {
		currentS, currentT := s[i], t[i]
		isAppearedCombo := false
		if i == 0 {
			combos = append(combos, combo{S: currentS, T: currentT})
		} else {
			for j := range combos {
				tmpS, tmpT := s[j], t[j]
				switch {
				case tmpS == currentS && tmpT == currentT:
					isAppearedCombo = true
					break
				case tmpS != currentS && tmpT != currentT:
					continue
				default:
					fmt.Println("No")
					return
				}
			}
		}
		if isAppearedCombo == true {
			continue
		}
		combos = append(combos, combo{S: currentS, T: currentT})
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 2176
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

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

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

int main(){
    int n; cin >> n;
    ll ans = 1LL;
    REP(i, n){
        ll t; cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int n, w;
  cin >> n >> w;
  vector<ll> W(n), V(n);
  rep(i,n) {
    cin >> W[i] >> V[i];
  }
  vector<vector<ll> > dp(n+5,vector<ll>(w+5, 0));
  rep(i,w+5) {
    dp[0][i] = 0; 
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= w; ++j) {
      if (j - W[i-1] >= 0) {
        dp[i][j] = max(dp[i-1][j], dp[i-1][j-W[i-1]] + V[i-1]);
      }
      else  dp[i][j] = dp[i-1][j];
    }
  }
  cout << dp[n][w] << endl;
  return 0;
}

Measured memory_bytes: 83456
#include<stdio.h>
int main(){

	int k,n,a[200000],i,max=0,shu;

	scanf("%d%d",&k,&n);

	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(i>0){
			if(max<(a[i]-a[i-1]))
				max=a[i]-a[i-1];
		}
	}

	if(max<k+a[0]-a[n-1])
		max=k+a[0]-a[n-1];

	printf("%d",k-max);	

	return 0;
}

Measured memory_bytes: 2936
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <queue>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int max_n = 100000;
const int max_m = 100000;
using namespace std;
typedef pair<int,int> P;
const int maxv = 100000;
const ll inf = 1LL<<60;

struct edge{
    int to;
    ll cost;
    edge(int a, ll b){
        to = a;
        cost = b;
    }
};

template<class Abel> struct Dijkstra{
    priority_queue<P,vector<P>,greater<P> > que;
    vector<vector<edge> > G;
    vector<ll> d;
    vector<int> prev;
    Dijkstra(){
        G.resize(maxv);
        d.resize(maxv,inf);
        prev.resize(maxv);
        //d[s] = 0;
        //que.push(P(0,s)); //.first = startからの距離　second = 現在地点
    }
    
    void dijkstra(int s){
        d[s] = 0;
        que.push(P(0,s));
        while(!(que.empty())){
            P p = que.top(); que.pop();
            int v = p.second;
            if(d[v] < p.first)continue;
            for(int i = 0; i < G[v].size(); i++){
                edge e = G[v][i];
                if(d[e.to] > d[v] + e.cost){
                    d[e.to] = d[v] + e.cost;
                    prev[e.to] = v;
                    que.push(P(d[e.to], e.to));
                }
            }

        }
    }
};

int main(){
    //cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
    int V,E,r; cin >>V>>E>>r;
    Dijkstra<ll> dij;
    REP(i,E){
        int s,t; ll d;
        cin>>s>>t>>d;
        dij.G[s].push_back(edge(t,d));
    }
    dij.dijkstra(r);
    REP(i,V){
        if(dij.d[i] == inf) cout << "INF" << endl;
        else cout <<dij.d[i]  << endl;
    }
}


Measured memory_bytes: 18928
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
char a[10][10];
int b[10];
int nex[8][2]={1,0,0,1,-1,0,0,-1,1,1,-1,-1,-1,1,1,-1};
int main()
{
    int h,w;
    while(~scanf("%d%d",&h,&w))
    {
        for(int i=0; i<h; i++)
            scanf("%s",a[i]);
        int flag=0,cnt=0,nx,ny;
        for(int i=2; i<h; i++)
        {
            for(int j=0; j<w; j++)
            {
                if(a[i][j]=='#')
                {
                    for(int pre=i-2; pre>=0; pre--)
                    {
                        if(a[pre][j]=='#')
                        {
                            for(int ii=pre;ii<i;ii++)
                            {
                                if(a[ii][j]!='#') {flag=1;break;}
                            }
                        }
                        if(flag) break;
                    }
                }
                if(flag) break;
            }
        }
        for(int i=1;i<h;i++)
        {
            cnt=0;
            for(int j=0;j<w;j++)
            {
                if(a[i][j]=='#'&&a[i-1][j]=='#') cnt++;
            }
            if(cnt>1) flag=1;
        }
        if(flag) puts("Impossible");
        else puts("Possible");
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,s,x,a[10],e[11],c,i,j,m;
    int l[]={9,26,50,80,115,154,196,240,285,330};
    while(~scanf("%d%d",&n,&s)){
        x=c=m=0;
        for(i=0;i<11;i++)e[i]=0;
        for(i=0;i<n;i++){
            a[i]=n-i-1;
            e[a[i]]=1;
            x+=a[i]*(i+1);
        }
        if(s>330) m=n;
        do{
            if(x==s)c++;
            if(x>=s)m++;
            for(i=0;i<n;i++){
                x-=a[i]*(i+1);
                e[a[i]]=0;
                if(i<m)continue;
                if(i==0)
                    a[i]=(s-x<10&&!e[s-x]?s-x:10);
                else
                    do{a[i]++;}while(e[a[i]]);
                if(a[i]>9){m++;continue;}
if(s-x>l[m]){
while(s-x>l[m])m++;
continue;
}
                e[a[i]]=1;
                x+=a[i]*(i+1);
                for(i--;i>=0;i--){
                    for(j=0;j<10;j++){
                        if(e[j])continue;
                        a[i]=j;
                        e[a[i]]=1;
                        x+=a[i]*(i+1);
                        break;
                    }
                }
                if(x>s) {
                    m++;
                    if(m>=n) break;
                    continue;
                }
                m=0;
                break ;
            }
        } while(m<n);
        printf("%d\n",c);
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>

using namespace std;

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

	if((b -a) <= 0 ){
		cout << "delicious";
	}else if((b -a) <= x){
		cout << "safe";
	}else {
		cout << "dangerous";
	}

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

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = b + a;
		int d = a * b;
		if(c == 15) {
			System.out.println("+");
		}else if(d == 15) {
			System.out.println("*");
		}else {
			System.out.println("x");
		}
		
	}
}

Measured memory_bytes: 21844
#include<stdio.h>

#define N 100000
#define mod 1000000007

int main(){
	int n,m,i,j;
	long long tmp=0,tmp2=0,x[N],y[N];
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)scanf("%lld",&x[i]);
	for(i=0;i<m;i++)scanf("%lld",&y[i]);
	for(i=0;i<n;i++){
		tmp+=x[i]*i;
		tmp%=mod;
	}
	for(i=0;i<n;i++){
		tmp-=x[i]*(n-i-1);
		tmp%=mod;
	}if(tmp<0)tmp+=mod;
	for(i=0;i<m;i++){
		tmp2+=y[i]*i;
		tmp2%=mod;
	}
	for(i=0;i<m;i++){
		tmp2-=y[i]*(m-i-1);
		tmp2%=mod;
	}if(tmp2<0)tmp2+=mod;
	printf("%lld\n",(tmp*tmp2)%mod);
	return 0;
}

Measured memory_bytes: 1664
function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const N=input[0].split(' ')[0]-0;
  const S=input[1];
  var count=S.split('').reduce((acc,cur)=>{
    return acc+(cur==='E'?1:0);
  },0)-(S[0]==='E'?1:0);
  var max=count;
  for(var i=1;i<N;i++){
    if(S[i]==='E'){
      count--;
    }
    if(S[i-1]==='W'){
      count++;
    }
    max=Math.min(count,max);
  }
  console.log(max)

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 35948
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl

int main(){
	int n,r;
	cin>>n>>r;
	int ans=r+max(0,100*(10-n));
	OUT(ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define WHITE '#'
#define BLACK '.'
#define NEWLINE '\n'

void
draw(int, int);

int
main(void)
{
    int h, w;
    while (scanf("%d %d", &h, &w) && h && w)
        draw(h, w);
    return 0;
}

void
draw(int h, int w)
{
    int i, j;
    char ch = WHITE;
    char s = WHITE;
    for (i = 0; i < h; i++) {
        ch = s;
        for (j = 0; j < w; j++) {
            putchar(ch);
            ch = ch ^ WHITE ^ BLACK;
        }
        putchar(NEWLINE);
        s = s ^ WHITE ^ BLACK;
    }
    putchar(NEWLINE);
}


Measured memory_bytes: 2100
N = int(input())
yes_set = []
k = 1
while k * (k + 1) < 2 * N:
    k += 1
if k * (k + 1) != 2 * N:
    print("No")
    quit()
ans = []
x = 1
for i in range(k + 1):
    row = []
    for j in range(i):
        row.append(ans[j][i - 1])
    for j in range(k - i):
        row.append(x)
        x += 1
    ans.append(row)
print("Yes")
print(k + 1)
for row in ans:
    print("{} {}".format(k, ' '.join(map(str, row))))


Measured memory_bytes: 8948
#include <iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a%3 == 0 || b%3 == 0 || (a+b)%3 == 0){
		cout << "Possible" << endl;
		}else{
			cout << "Impossible" << endl;
		}
	return 0;
}

Measured memory_bytes: 384
/**
 * Created by Sakib on 06/11/2018.
 */
#include <bits/stdc++.h>
using namespace std;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(args...) { dbg,args; cerr<<"\n"; }
struct debugger{
template<typename T>debugger& operator,(const T& v){cerr<<v<<" ";return *this;}}dbg;

#define Fix( x ) setprecision( x ) << fixed
#define mem( a , x ) memset( a , x , sizeof( a ) )
#define bug( a , b ) cerr<< #a <<" = "<<a<<" , "<< #b <<" = "<<b<<"\n";
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define FOR( i , a , b ) for( int i = a; i <= b; i++ )
#define ROF( i , a , b ) for( int i = a; i >= b; i-- )
#define sz( V ) (int)V.size( )
#define all( V ) V.begin( ),V.end( )
#define Found( S , val ) S.find( val ) != S.end( )
#define Unique( V ) sort( all( V ) ), V.erase( unique( all( V ) ), V.end() )
typedef pair < int , int > ii;
typedef pair < int , ii > iii;
typedef long long int LL;
typedef unsigned long long uLL;
const int inf = (int)1e9;
const LL INF = (LL)1e18;
const int N = 100005;
const int mod = 1000000007;
const double eps = 1e-8;
const double pi = acos( -1.0 );

vector <LL> yen;
LL n;
LL dp[ 15 ][ 10*N ];
int len;

void calc( ) {
    yen.pb( 1 );
    for( LL i = 6; i <= 100000; i *= 6 ) yen.pb( i );
    for( LL i = 9; i <= 100000; i *= 9 ) yen.pb( i );
    len = sz(yen);
    //cout << sz(yen) << endl;
    //for( auto x : yen ) cout << x << " ";
}
LL go( int pos , LL rem ) {
    //cout <<"rem : " << rem << endl;
    if( pos >= len ) return ( rem == 0 ? 0 : INF );
    if( rem == 0 ) return 0;
    if( rem < 0 ) return INF;
    if( dp[pos][rem] != -1 ) return dp[pos][rem];
    LL op1 = INF , op2 = INF;
    op1 = min( op1 , go( pos+1 , rem ) );
    op2 = min( op2 , go( pos , rem-yen[pos] )+1 ) ;
    //bug( op1 , op2 );
    return dp[pos][rem] = min( op1 , op2 );
}
int main( int argc, char const *argv[] ) {
    fast_io;
    calc( );
    cin >> n;
    mem( dp , -1 );
    cout << go( 0 , n ) << endl;
    return 0;
}











Measured memory_bytes: 122112
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;
static const int INF = (int)1e8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FIND(m,w) ((m).find(w)!=(m).end())

string seg[10] = {
  "0111111",
  "0000110",
  "1011011",
  "1001111",
  "1100110",
  "1101101",
  "1111101",
  "0100111",
  "1111111",
  "1101111"
};

int main(void){
  int n;
  while(cin>>n,n+1){
    vector<int> num(n);
    REP(i,n)cin>>num[i];
    REP(i,n){
      if(i==0)cout<<seg[num[i]]<<endl;
      else{
        string out;
        REP(j,7){
          if(seg[num[i]][j]!=seg[num[i-1]][j])out+="1";
          else out+="0";
        }
        cout<<out<<endl;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] prime = new int[101000];
		boolean[] isp = new boolean[101000];
		int x = sc.nextInt();
		for (int i = 0; i < isp.length; i++) {
			isp[i] = true;
		}
		int p = 0;
		isp[0] = false; isp[1] = false;
		for (int i = 2; i < 101000; i++) {
			if(isp[i]) {
				prime[p] = i;
				p++;
				for(int j = 2*i;j < 101000; j += i) {
					isp[j] = false;
				}
			}
		}
		int i = 0;
		while(true) {
			if(prime[i] >= x) {
				System.out.println(prime[i]);
				break;
			}
			i++;
		}
		sc.close();
	}
}

Measured memory_bytes: 23892
from collections import deque
H, W = map(int, input().split())
s = [list(input()) for i in range(H)]

white = 0

for i in range(H):
    white += s[i].count(".")

q = deque()
q.append((0, 0))

g = [[10**9]*W for i in range(H)]
g[0][0] = 0
for i in range(H*W):
    if len(q) == 0:
        break
    x, y = q.popleft()
    if (x, y) == (H-1, W-1):
        break
    else:
        if x < H-1 and s[x+1][y] == ".":
            if g[x+1][y] == 10**9:
                q.append((x+1, y))
            g[x+1][y] = min(g[x+1][y], g[x][y]+1)
        if y < W-1 and s[x][y+1] == ".":
            if g[x][y+1] == 10**9:
                q.append((x, y+1))
            g[x][y+1] = min(g[x][y+1], g[x][y]+1)
        if x > 0 and s[x-1][y] == ".":
            if g[x-1][y] == 10**9:
                q.append((x-1, y))
            g[x-1][y] = min(g[x-1][y], g[x][y]+1)
        if y > 0 and s[x][y-1] == ".":
            if g[x][y-1] == 10**9:
                q.append((x, y-1))
            g[x][y-1] = min(g[x][y-1], g[x][y]+1)
if g[H-1][W-1] == 10**9:
    print(-1)
else:
    print(white - (g[H-1][W-1]+1))


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

int main(){
  int flag=0;
  std::string s;
  std::cin >> s;
  if(s.find("a")==std::string::npos){
    flag++;
  }
  if(s.find("b")==std::string::npos){
    flag++;
  }
  if(s.find("c")==std::string::npos){
    flag++;
  }
  if(flag==0){
    std::cout << "Yes" << std::endl;
  }else{
    std::cout << "No" << std::endl;
  }
  return 0;
	     
}


Measured memory_bytes: 256
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] array = new String[n];
        for (int i = 0; i < n; i++) {
        	array[i] = sc.next();
        }
		int bf = 0;
		bf = array.length;;
		int af = 0;
		Set<String> linkedHashSet = new LinkedHashSet<String>();
	    for (int i = 0; i < array.length; i++) {
	        linkedHashSet.add(array[i]);
	        }

	    Object[] strings_after = linkedHashSet.toArray();
	    af = strings_after.length;

	    if(af == bf){
	    	System.out.println("YES");
	    }else{
	    	System.out.println("NO");
	    }
		}
}

Measured memory_bytes: 72168
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) cout << (x) << endl
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int x[n], y[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        vec[i] = i;
    }
    double cnt = 0, sum = 0;
    do {
        cnt++;
        int idx = find(ALL(vec), 0) - vec.begin();
        for (int i = 1; i < n; i++) {
            int tmpidx = find(ALL(vec), i) - vec.begin();
            sum += sqrt((x[tmpidx] - x[idx]) * (x[tmpidx] - x[idx]) +
                        (y[tmpidx] - y[idx]) * (y[tmpidx] - y[idx]));
            idx = tmpidx;
        }
    } while (next_permutation(ALL(vec)));
    cout << setprecision(10) << sum / cnt << endl;
}


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

using ll = long long;

using namespace std;

// xorの掃き出し法 O(N^2)
// matに基底たちが入る
// Tはbitsetは無理(minしないといけないから)
template <typename T>
int gauss_jordan(vector<T> &mat) {
    vector<T> bases;
    for (auto e:mat) {
        for (auto &b:bases) {
            e = min(e, e^b);
        }
        if (e)
            bases.push_back(e);
    }
    mat.swap(bases);
    return (int)mat.size();
}

int main() {
    int T;
    cin >> T;
    while (T--) {
        int n; cin >> n;
        ll a[n]; for (auto &ai:a) cin >> ai;
        string s; cin >> s;
        bool ans = false;
        vector<ll> bases;
        for (int i=n-1; i>=0; i--) {
            bool now = s[(size_t)i] - '0';
            if (now) {
                for (auto &bi:bases) {
                    a[i] = min(a[i], a[i]^bi);
                }
                if (a[i]) {
                    ans = true;
                    break;
                }
            } else {
                bases.push_back(a[i]);
                gauss_jordan(bases);
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

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

namespace AtCoderCs
{

    class Program
    {

        const int Mod = 1000000007;

        static void Main()
        {

            var arg = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();

            var x = arg[1] <= arg[2] ? ((arg[2] / arg[1]) * arg[1] - 1) : arg[2];
            Console.WriteLine(((arg[0] * x) / arg[1]) - arg[0] * (x / arg[1]));

        }


    }
}


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

d = [[0]*10 for i in range(10)]

for i in range(1, n+1):
  i_ = str(i)
  x = int(i_[0])
  y = int(i_[-1])
  d[x][y] += 1

ans = 0
for i in range(10):
  for j in range(10):
    ans += d[i][j]*d[j][i]
    
print(ans)

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

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

#define DIVUP(x, y) (((x) + ((y) - 1)) / (y))
#define DIVOFF(x, y) (((x) + ((y) / 2)) / (y))
#define REMAINDER(x, y) ((x) % (y))

int N, K;
int ans;

int main() {
  scanf("%d%d", &N, &K);
  ans = K;
  for (int i{1}; i < N; ++i) ans *= K - 1;

  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>


using namespace std;

void Solution()
{
    const int weight[] = {2, 3, 5, 10, 12, 15}; //10 = 5袋買った時、12 = 4袋買った時, 15 = 3袋買った時
    const int value[] = {380, 550, 850, 1520, 1870, 2244}; //1520, 1870, 2244 = 割引がある時
    const int num = 6;
    
    int dp[52]; // 25 + 17 + 10
    
    int amount;
        
    for (int i = 0; i <= 52; i++)
    {
        dp[i] = 1000000000;
    }
    
    dp[0] = 0;
    
    for(int i = 0; i < 52; i++)
    {
        for(int j=0; j < num; j++)
        {
            if(i - weight[j] >= 0)
            {
                dp[i] = min(dp[i], dp[i - weight[j]] + value[j]);
            }
        }
    }
    
    while(cin>>amount)
    {
        if(amount == 0)
        {
            break;
        }
        
        cout<<dp[amount / 100]<<endl;
    }
}

int main()
{
    Solution();
    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main() {
  int width, height, x, y, r;
  scanf("%d", &width);
  scanf("%d", &height);
  scanf("%d", &x);
  scanf("%d", &y);
  scanf("%d", &r);

  if ((x - r) >= 0 && (x + r) <= width) {
    if ((y - r) >= 0 && (y + r) <= height)
      printf("Yes\n");
    else
      printf("No\n");
  }
  else
    printf("No\n");

  return 0;
}




Measured memory_bytes: 1728
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n; cin >> n;
    vi a(n); for(auto& e : a) cin >> e;

    vi res;
    vi tbl(n);
    rrep(i, n){
        int sum = a[i];
        for(int j = i; j < n; j += (i+1)){
            sum += tbl[j];
        }
        if(sum % 2 == 1){
            tbl[i] = 1;
            res.emplace_back(i);
        }
    }
    sort(_all(res));

    cout << res.size() << endl;
    for(auto& e : res){
        cout << e+1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3192
n = int(input())
total = 0
for i in range(n):
  d = list(map(int,input().split()))
  if d[0]==d[1]:
    if total != 0:
      total +=1
      if total ==3:
        print('Yes')
        break
    else:
      total = 1
  else:
    total = 0
if total !=3:
  print('No')

Measured memory_bytes: 9176
/*Bismillahir Rahmanir Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
map<string,ll>mp;
map<ll,ll>mpp;
vector<ll>v;
#define Y cout<<"YES"<<endl
#define N cout<<"NO"<<endl

int main()
{
    ll n,i,j,k,t,w,s;

    cin>>s>>w;

    if(w>=s){
        cout<<"unsafe"<<endl;
    }
    else{
        cout<<"safe"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636
from collections import deque

N,M = [int(v) for v in input().split()]
ad_list = [[] for _ in range (N+1)]
ad_num = [0 for _ in range(N)]
topo = []

for _ in range(N-1+M):
    l,r = [int(v) for v in input().split()]
    ad_list[l].append(r)
    ad_num[r-1] += 1

for i in range(1,N+1):
    if ad_num[i-1] == 0:
        topo.append(i)
queue = deque(topo[:])
topo = [[0,topo[0]]]
while queue:
    n1 = queue.popleft()
    for n2 in ad_list[n1]:
        ad_num[n2-1] -= 1
        if ad_num[n2-1] == 0:
            topo.append([n1,n2])
            queue.append(n2)
topo.sort(key=lambda x:x[1])
for i,v in topo:
    print(i)
#  visited = [False for _ in range(N)]

#  ans = 0
#  path_len = 0
#  def dfs(node,cnt=1):
    #  global ans
    #  if visited[node-1]: return 0
    #  visited[node-1] = True
    #  ans = max(ans,cnt)
    #  for n in ad_list[node]:
        #  dfs(n,cnt+1)

#  for n in range(1,N+1):
    #  dfs(n)
#  print(ans)


Measured memory_bytes: 82720
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,r,n) for(int i=r; i<=n; i++)
#define sz(v) (int)(v).size()
#define vec(x) vector < x >
using vi = vector < int >;
using mii = map <int , int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
using int64 = long long;
const int inf = 2e9 + 7;
const char nwl = '\n';
const int mxx = 1e6 + 3;
int64 sumV(vi &v) {
	int64 s = 0;
	for (int x : v) {
		s += (int64)x;
	}
	return s;
}
int gcd(int a, int b) {
	if (!b) return a;
	return gcd(b, a % b);
}
//const int64 biGinf = 9e+18;
//const string yo = "Yes\n", no = "No\n";
using ld = long double;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	int64 n;
	ld x;
	cin >> n >> x;

	int64 t = 0;

	for0(i, n) {
		int a, b;
		cin >> a >> b;
		ld d = sqrt((ld)a * a +  (ld)b * b);
		if (d <= x) t++;
	}


	cout << t;

	return 0;
}

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<int>ac(n),wa(n);
  for(int i=0;i<m;i++){
    string s;
    int c;
    cin>>c>>s;
    c--;
    if(ac[c])continue;
    if(s=="AC"){
      ac[c]=1;
    }else{
      wa[c]++;
    }
  }
  int AC=0,pena=0;
  rep(i,n){
    AC+=ac[i];
    if(ac[i])pena+=wa[i];
  }
   cout<<AC<<" "<<pena<<endl;       
 
}

Measured memory_bytes: 1024
numberOfArray=int(input())
arrayList=list(map(int,input().split()))

def bubbleSort():
    frag=1
    count=0
    while frag:
        frag=0
        for i in range(1,numberOfArray):
            if arrayList[i-1]>arrayList[i]:
                arrayList[i-1],arrayList[i]=arrayList[i],arrayList[i-1]
                frag=1
                count+=1
    arrayForReturn=str(arrayList[0])
    for i2 in range(1,numberOfArray):
        arrayForReturn+=" "+str(arrayList[i2])
    print(arrayForReturn)
    print(count)

#------------------main--------------
bubbleSort()


Measured memory_bytes: 5600
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_170_FiveVariables
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            //string s = Console.ReadLine();

            // 整数の入力
            //long n = long.Parse(Console.ReadLine());

            // 文字列配列の入力
            string[] inputStrArray = Console.ReadLine().Split(' ');

            //// 整数配列の入力
            //var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            for (int i = 0; i < inputStrArray.Length; i++)
            {
                if (inputStrArray[i] == "0" )
                {
                    Console.WriteLine(i + 1);
                    break;
                }
            }

            //string result = "";

            //Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 25832
/*
 * atcoder/abc149_3rd/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

int N, K;
int S[3];
string T;
vector<int> A;
ll dp[100001][3];
int score(int me, int you) {
  if (me==0 and you==1) return S[0];
  if (me==1 and you==2) return S[1];
  if (me==2 and you==0) return S[2];
  return 0;
}
void solve() {
  cin >> N >> K >> S[0] >> S[1] >> S[2] >> T;
  A.resize(N);
  loop(n,0,N) {
    if (T[n]=='r') A[n] = 0;
    if (T[n]=='s') A[n] = 1;
    if (T[n]=='p') A[n] = 2;
  }

  for (int i=0; i<N; i++) {
    for (int p=0; p<3; p++) {
      if (i<K) { dp[i][p] = score(p, A[i]); continue; }
      for (int pre_p=0; pre_p<3; pre_p++) {
        if (pre_p==p) continue;
        chmax(dp[i][p], dp[i-K][pre_p] + score(p, A[i]));
      }
    }
  }

  ll total = 0;
  for (int k=0; k<K; k++) {
    total += max(dp[N-1-k][0], max(dp[N-1-k][1], dp[N-1-k][2]));
  }
  cout << total << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 3200
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int n;
  scanf("%d",&n);
  char t[]={'M','A','R','C','H'};
  int64 cnt[]={0,0,0,0,0};
  int i;
  for(i=0;i<n;i++){
    char s[11];
    scanf("%s",s);
    int j;
    for(j=0;j<5;j++){
      if(t[j]==s[0]){
	cnt[j]++;
      }
    }
  }
  int64 ans=0;
  int j,k;
  for(i=0;i<5;i++){
    for(j=i+1;j<5;j++){
      for(k=j+1;k<5;k++){
	ans+=cnt[i]*cnt[j]*cnt[k];
      }
    }
  }
  printf("%lld\n",ans);
  return;
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e16;

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    string S; cin >> S;
    S[3] = '8';
    cout << S << endl;
	return 0;
}


Measured memory_bytes: 764
#include <stdio.h>

int main(void){
	int topB,topC;
	int n,tmp;
	int valid;
	
	for (scanf("%d", &n); n--;){
		topB=topC=0;
		valid=1;
		for (int i=0; i<10; i++){
			scanf("%d", &tmp);
			if (tmp > topB) topB=tmp;
			else if (tmp > topC)topC=tmp;
			else {
				valid=0;
				for (;i<10;i++) scanf("%d", &tmp);
				break;
			}
		}
		printf("%s\n",valid?"YES":"NO");
	}
	return 0;
}

Measured memory_bytes: 1008
#include<iostream>

using namespace std;
const int N=200000;
int main(){
	int i,j,n,k,dp[N],a[N];
	cin>>n>>k;
	for(i=0;i<n;++i) cin>>a[i];
	for(i=1;i<=k;++i){
		dp[i]=abs(a[0]-a[i]);
	}
	for(i=k+1;i<n;++i){
		dp[i]=abs(a[i]-a[i-k])+dp[i-k];
		for(j=i-k+1;j<i;++j){
			dp[i]=min(dp[i],abs(a[i]-a[j])+dp[j]);
		}
		
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	string s;
	cin >> s;
	sort(s.begin(),s.end());
	int n = s.size();
	for(int i = 0;i<n-1;i++)
	{
		if(s[i]==s[i+1])
		{
			cout<<"no"<<endl;
			return 0;
		}
	}
	cout<<"yes"<<endl;
	
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX_N = 200000;
 
int n, a[MAX_N], m, b[MAX_N];
 
int main(){
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    cin >> m;
    for(int i = 0; i < m; i++) cin >> b[i];
    bool flag = true;
    for(int i = 0; i < m; i++){
        if(!binary_search(a, a + n, b[i])) flag = false;
    }
    if(flag) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 4636
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
 
int main() {
long long a,b,c,d,f,g,h,i;
cin>>a>>b>>c>>d;

f=a*c;
g=a*d;
h=b*c;
i=b*d;

cout <<max({f,g,h,i});


 return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
#define FOR(i,l,r) for(int i = l ; i <= r ;++i )
#define inf 1<<30
#define EPS (1e-9)
#define ALL(T)  T.begin(),T.end()
#define lson(i)     i<<1
#define rson(i)     (i<<1|1)
using namespace std;
typedef pair<int,int> pii;

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	cout <<max(0,b+c-a)  << endl;

}

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

int N;

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


Measured memory_bytes: 256
//#define India

#ifndef India
#include <bits/stdc++.h>
#else
#include "total.h"
#endif
#define fori(n) for(long long i=0;i<n;i++)
#define forr(i,x,y) for(long long i=x;i<y;i++)
#define forj(n) for(long long j=0;j<n;j++)
#define ll long long
#define d7 1000000007
#define en cout<<"\n";

using namespace std;

ll x=-1,kk=-1;
bool jpo=false;
void dfs(ll s, vector<bool> &v, vector<ll> &pr, vector<ll> adj[]){
    if(v[s]) return;
    v[s]=true;
    //cout<<s+1<<" ";
    for(auto u: adj[s]){
        if(!v[u]){
            pr[u]=s;
            //cout<<u<<" ";
            dfs(u,v,pr,adj);}
        else{
            if(!jpo&&pr[s]!=u){jpo=true;x=u;kk=s;}
        }
    }
}
ll binomialCoeff(ll n, ll k){
   ll C[n + 1][k + 1];ll i, j;
   for (i = 0; i <= n; i++){
       for (j = 0; j <= min(i, k); j++){
           if (j == 0 || j == i){C[i][j] = 1;}
           else{C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);}}}
   return C[n][k];
}
void bfs(vector<ll> &dis, vector<ll> adj[], ll s, vector<ll> &parent){
    dis[s]=0;
    //parent[s]=-1;
    queue<ll> q;
    q.push(s);
    while(!q.empty()){
        ll z=q.front();
        //cout<<z<<" ";
        q.pop();
        for(auto v:adj[z]){
            if(dis[v]==0){
            q.push(v);
            dis[v]=dis[z]+1;
                parent[v]=z;
            }
        }
    }
}

ll modexp(ll x, ll n,ll m){
    if(n==0) return 1%m;
    ll u=modexp(x,n/2,m);
    u=(u*u)%m;
    if(n%2==1) u=(u*x)%m;
    return u;
}

ll modinv(ll x, ll mod) { return modexp(x, mod - 2, mod); }
const int Nx=1e6+5;
ll fact[Nx];
void factorial(){fact[0]=1;
    for(int i=1;i<Nx;i++)
    {
        fact[i]=(fact[i-1]*i)%d7;
    }
    return ;}
ll binomial(ll a,ll b,ll mod){
    return ((fact[a]*modinv(fact[b],mod))%mod*modinv(fact[a-b],mod))%mod;}

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

tuple<ll,ll,ll,ll> expA(tuple<ll,ll,ll,ll> v, ll n){
    if(n==0){return {1,0,1,0};}
    if(n==1){return v;}
        ll x1,y1,z1,w1;
        ll x2,y2,z2,w2;
        tie(x1,y1,z1,w1) = expA(v, n/2);
        x2=(x1*x1+y1*z1)%d7;
        y2=(x1*y1+y1*w1)%d7;
        z2=(z1*x1+w1*z1)%d7;
        w2=(z1*y1+w1*w1)%d7;
    if(n%2==0){
        return {x2,y2,z2,w2};
    }
    else{
        return {x2+z2,y2+w2,x2,y2};
    }
}

//ll st[200010][30];
//ll loge2[200001];
//void logify(){
//loge2[1] = 0;
//for (ll i = 2; i <= 200001; i++)
//    loge2[i] = loge2[i/2] + 1;
//}

int main(){
    
    
    ll n;
    cin>>n;
    double s=6.28318530717958623200*n;
    cout<<setprecision(15)<<s;
    
    return 0;
}


Measured memory_bytes: 3820
/**
**	author : Raghav
**	codechef:raghav_456
**	codeforces:raghavramola7
**/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define deb(x)          cout<<#x<<" "<<x<<endl
#define ar 				array
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void Raghav()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int32_t main()
{
	Raghav();
	int n, ans = 0;
	float d;
	cin >> n >> d;
	d = d * 1.0;
	double di;
	while (n--)
	{
		int a, b;
		cin >> a >> b;
		di = (a * a + b * b) * 1.0;
		di = sqrt(di);
		if (di <= d)
			ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3796
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
vector<pair<string,string> > mem;
vector<int> num;
void Find(pair<string,string> c){
	for(int i=0;i<mem.size();i++){
		if(mem[i]==c){
			num[i]++;
			return;
		}
	}
	mem.push_back(c);
	num.push_back(1);
}
int main(){
	int n,m,f;
	cin>>n>>f;
	string s[10];
	for(int u=0;u<n;u++){
		cin>>m;
		for(int i=0;i<m;i++){
			cin>>s[i];
			for(int j=0;j<i;j++){
				pair<string,string> c;
				if(s[i]<s[j])c.first=s[i],c.second=s[j];
				else c.first=s[j],c.second=s[i];
				Find(c);
			}
		}
	}
	int i=0;
	while(i<mem.size()){
		if(num[i]<f){
			mem.erase(mem.begin()+i);
			num.erase(num.begin()+i);
			i--;
		}
		i++;
	}
	sort(mem.begin(),mem.begin()+mem.size());
	cout<<mem.size()<<endl;
	for(int i=0;i<mem.size();i++){
		cout<<mem[i].first<<" "<<mem[i].second<<endl;
	}
	return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n, plus = 0;
    bool isZero = false;
    cin >> n;
    ll A[n];
    repi(i, n, 0)
    {
        cin >> A[i];
        if (A[i] == 0)
        {
            isZero = true;
        }
        if (A[i] > 0)
        {
            plus++;
        }
    }
    ll ans = 0, m = INF;
    repi(i, n, 0)
    {
        ans += abs(A[i]);
        m = min(m, abs(A[i]));
    }
    if (!isZero && (n - plus) % 2)
    {
        ans -= 2 * m;
    }
    cout << ans << endl;
    return 0;
}

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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

const double pi = 3.141592653589793;

#define xx          first
#define yy          second
#define mp          make_pair
#define intl        long long
#define filein      freopen("input.txt", "r", stdin)
#define fileout     freopen("output.txt", "w", stdout)
#define debug       cout << "YES" << endl
#define what_is(x)  cout << #x << " is " << x << endl
#define pb          push_back
#define pii         pair<int, int>

//find_by_order(int) and order_of_key(int)
//typedef tree < intl , null_type ,less<intl>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;
const int M = 345678;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    //filein;
    string s;
    cin >> s;
    for( int i = s.length()-1; i > 0; i-- )
    {
        if( s[i] == 'C' && s[i-1] == 'A' )
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
a,b=gets.split.map &:to_i
c=gets.split.map &:to_i
d=0
if c[0]>b
  d=c[0]-b
  c[0]=b
end
(a-1).times do |i|
  g=c[i]+c[i+1]
  if g>b
    d+=g-b
    c[i+1]-=g-b
  end
end
p d

Measured memory_bytes: 8584
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

ll nck(ll n, ll k){
    ll ret = 1;
    rep(i, k){
        ret *= (n - i);
        ret /= (i + 1);
    }
    return ret;
}

int main() {
    int n, p;
    cin >> n >> p;
    vector<int> a(n);
    rep(i, n)cin >> a[i];
    int o = 0;
    int e = 0;
    rep(i, n){
        if(a[i] % 2 == 0)e++;
        else o++;
    }

    if(p == 1){
        ll odd = 0;
        rep(i, (o+1)/2){
            odd += nck(o, i*2+1);
        }
        ll even = 0;
        rep(i, e+1){
            even += nck(e, i);
        }
        ll ans = odd * even;
        cout << ans << endl;
    }else{
        ll odd = 0;
        rep(i, o/2+1){
            odd += nck(o, i*2);
        }
        ll even = 0;
        rep(i, e+1){
            even += nck(e, i);
        }
        cout << odd * even << endl;
    }
    
}

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

int main(){
    string s;

    cin>>s;

    string alf = "qazwsxedcrfvtgbyhnujmiklop";

    int count[27] = {0};

    for(int i=0;i<s.size();i++){
        for(int j=0;j<27;j++){
            if(s[i] == alf[j]) count[j]++;
        }
    }

    bool diff = true;

    for(int i=0;i<27;i++){
        if(count[i] > 1) diff = false;
    }

    if(diff) cout<<"yes\n";
    else cout<<"no\n";

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n;
vl f[101];
int main(){FAST;
  cin>>n;
for(int i=1;i<=n;++i){
  ll x = i;
  vl a;
  while(x){
    a.pb(x%10);
    x/=10;
  }
  reverse(all(a));
  f[a.front()*10+a.back()].pb(i);
}
ll ans= 0;
for(ll i=1;i<=n;++i){
  if(i%10 == 0)continue;
  ll x = i;
  vl a;
  while(x){
    a.pb(x%10);
    x/=10;
  }
  ans+=f[a.front()*10+a.back()].size();
}
cout<<ans;
return 0;
}

Measured memory_bytes: 2528