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

int main(void){
        string Taro;
        string Hanako;
        int n;
        cin>>n;
        int taro_score=0;
        int hanako_score=0;
        for(int i=0; i<n; i++) {
                cin>>Taro>>Hanako;
                if(Taro==Hanako) {
                        taro_score+=1;
                        hanako_score+=1;
                }
                else if(Taro<Hanako) {
                        hanako_score+=3;
                }
                else{
                        taro_score+=3;
                }
        }
        cout<<taro_score<<" "<<hanako_score<<endl;
}



Measured memory_bytes: 3140
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {

      
 public static void main(String[] args) {
    
    Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    int N = in.nextInt(); // Scanner has functions to read ints, longs, strings, chars, etc.
    int[][] arr = new int[N][3];
    //int[][3] dp = new int[N][3];
    int max = Integer.MIN_VALUE;
    
    for (int i = 0 ; i < N; ++i) {
        arr[i][0] = in.nextInt();
        arr[i][1] = in.nextInt();
        arr[i][2] = in.nextInt();
        
        if(i > 0) {
             arr[i][0] = Math.max(arr[i][0]+arr[i-1][1], arr[i][0]+arr[i-1][2]);
             arr[i][1] = Math.max(arr[i][1]+arr[i-1][0], arr[i][1]+arr[i-1][2]);
             arr[i][2] = Math.max(arr[i][2]+arr[i-1][0], arr[i][2]+arr[i-1][1]);
        }
       
        max = Math.max(Math.max(Math.max(max, arr[i][0]),arr[i][1]),arr[i][2]);
    }


    System.out.println(max);
  }
  
}

Measured memory_bytes: 96564
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)
 
ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

ll mod=1000000007;

int main(){
    ll a=ii();
    oie(a+a*a+a*a*a);
    return 0;
}

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

int main () {
  	string s;
  	cin >> s;
  	for (int i=0;i<3;i++) {
    	if (s[i] == '7') {
        	cout << "Yes" << endl;
          	return (0);
        }
      	
    }
  	cout << "No" << endl;
}

Measured memory_bytes: 3580
/**
*   author:  akifpathan
*   created: Sunday 27.09.2020 06:13:17 PM
**/

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

#ifdef LOCAL
#include "debug.h"
#else
#include<bits/stdc++.h>
using namespace std;
#define debug(x...)
#endif
 
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> 
using ordered_set= tree<T, null_type, 
		less<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
template<class T> 		
using ordered_mset= tree<T, null_type, 
		less_equal<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
		
*/
 
/*
 
PBDS
-------------------------------------------------
			0 based indexing
-------------------------------------------------			 
1) insert(value)
2) erase(value)
3) order_of_key(value) // Number of items strictly smaller than value
4) *find_by_order(k) : K-th element in a set (counting from zero)
 
*/
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());	

struct seg_tree
{
	vector<int>ara;
	vector<int>Tree;
	
	seg_tree(int n)
	{
		ara.resize(n+1);
		Tree.resize(4*n+1);
	}
	
	void update(int l,int r,int indx,int val,int at)
	{
		if(l==r)
		{
			Tree[at]=val;
			return;
		}
		
		int mid=(l+r)/2;
		
		if(indx<=mid) update(l,mid,indx,val,at*2);
		else update(mid+1,r,indx,val,at*2+1);
		
		Tree[at]=max(Tree[at*2],Tree[at*2+1]);
	}
	
	int query(int tL,int tR,int rL,int rR,int at)
	{
		if(tL>rR || tR<rL) return -1000000000;
		if(tL>=rL && tR<=rR) return Tree[at];
		
		int mid=(tL+tR)/2;
		
		int a=query(tL,mid,rL,rR,at*2);
		int b=query(mid+1,tR,rL,rR,at*2+1);
		
		return max(a,b);
	}
	
};

const int mx=3e5+5;

void solve()
{
	int n,k;
	cin>>n>>k;
	
	seg_tree st(mx);
	
	for(int i=1;i<=n;i++) 
	{
		cin>>st.ara[i];
		st.ara[i]++;
	}
	
	for(int i=n;i>0;i--)
	{
		int l=max(1,st.ara[i]-k);
		int r=min(mx,st.ara[i]+k);
		
		int maxi=st.query(1,mx,l,r,1)+1;
		
		int indx=st.ara[i];
		int now=st.query(1,mx,indx,indx,1);
		
		if(now<maxi) st.update(1,mx,indx,maxi,1);
		
		now=st.query(1,mx,indx,indx,1);
		
		debug(indx,l,r,now,maxi);
	}
	
	cout<<st.query(1,mx,1,mx,1);
}		

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	int testcase=1;
	//cin>>testcase;
	
	for(int i=1;i<=testcase;i++)
	{
		//cout<<"Case "<<i<<": ";
		solve();
	}
	
	#ifdef LOCAL
	cerr<<"\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
	#endif
	
	
	return 0;
}



Measured memory_bytes: 9028
n, m, k = map(int, input().split())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
from itertools import accumulate
AS = [0] + list(accumulate(A))
BS = [0] + list(accumulate(B))
 
ans = 0
j = m
for i in range(n+1):
    if AS[i] > k:
        break
 
    while AS[i] + BS[j] > k:
        j -= 1
    ans = max(ans, i+j)
        
print(ans)

Measured memory_bytes: 50740
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n;
    cin >> n;
    vi a(n);
    map<int, int> cnt;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    if (cnt.size() == 1) {
        int colors = a[0];
        if ((1 <= colors && colors <= n / 2) || colors == n - 1)
            cout << "Yes"
                 << "\n";
        else
            cout << "No"
                 << "\n";
        return 0;
    }
    if (cnt.size() > 2) {
        cout << "No"
             << "\n";
        return 0;
    }
    int a1, a2;
    a1 = cnt.begin()->first;
    a2 = cnt.rbegin()->first;
    if (a1 + 1 != a2) {
        cout << "No"
             << "\n";
        return 0;
    }
    int b1, b2;
    b1            = cnt.begin()->second;
    b2            = cnt.rbegin()->second;
    int colorsmin = b1 + 1;
    int colorsmax = b1 + b2 / 2;
    if (colorsmin <= a2 && a2 <= colorsmax) {
        cout << "Yes"
             << "\n";
    } else {
        cout << "No"
             << "\n";
    }
    return 0;
}

Measured memory_bytes: 5376
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
in ggt(in a, in b){
  if(b==0)
    return a;
  return ggt(b,a%b);
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n,a,k;
  cin>>n>>k;
  in mx=-1;
  in g=0;
  forn(z,n){
    cin>>a;
    mx=max(mx,a);
    g=ggt(g,a);
  }
  if(mx>=k && k%g==0){
    cout<<"POSSIBLE"<<endl;
  }
  else
    cout<<"IMPOSSIBLE"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(void){
    long long int a, b, c, d;
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    long long int ans=a*c;
    if(a*d>ans)ans=a*d;
    if(b*c>ans)ans=b*c;
    if(b*d>ans)ans=b*d;
    
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1736
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

#include <complex>
typedef complex<double> Point;

double dot(const Point &a, const Point &b) {
  return real(conj(a) * b);
}

int n;
double r, theta;
Point p[100];
double matrix[30][30][30];
double dp[2][30][30];

int main() {
  while (scanf("%d %lf %lf", &n, &r, &theta) > 0) {
    REP(i, 30) REP(j, 30) REP(k, 30) { matrix[i][j][k] = 1e+100; }
    REP(i, n) {
      double x, y;
      scanf("%lf %lf", &x, &y);
      p[i] = Point(x, y);
    }
    REP(prev, n) {
      REP(from, n) {
        REP(to, n) {
          if (from == to) { continue; }
          Point vect1 = p[from] - p[prev];
          Point vect2 = p[to] - p[from];
          double c = dot(vect1, vect2) / abs(vect1) / abs(vect2);
          double threshold = cos(theta / 180.0 * PI);
          if (c >= threshold || prev == from) {
            matrix[prev][from][to] = abs(vect2);
          }
        }
      }
    }
    REP(i, 2) REP(j, 30) REP(k, 30) { dp[i][j][k] = 1e+100; }
    int ans = 0;
    dp[0][0][0] = 0;
    REP(iter, 10000) {
      bool end = true;
      int prev = iter & 1;
      int next = prev ^ 1;
      REP(i, 30) REP(k, 30) { dp[next][i][k] = 1e+100; }
      REP(p, n) {
        REP(from, n) {
          REP(to, n) {
            double ncost = dp[prev][p][from] + matrix[p][from][to];
            if (ncost < dp[next][from][to] && ncost < r) {
              dp[next][from][to] = ncost;
              end = false;
              ans = iter + 1;
            }
          }
        }
      }
      if (end) { break; }
    }
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 1132
n,x = map(int,input().split())
a,p = [1], [1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(n,x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + a[n-1]:
        return f(n-1,x-1)
    else:
        return p[n-1] + 1 + f(n-1, x-2-a[n-1])

print(f(n,x))

Measured memory_bytes: 3064
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

#a = list(map(int, input().split()))

n = int(input())

if(n>=2000):
    print(1)
else:
    c = n//100
    p = n%100
    if(p>c*5):
        print(0)
    else:
        print(1)

Measured memory_bytes: 38384
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        mut s: [String; n],
    }
    s.sort();
    s.dedup();
    println!("{}", if s.len() == 3 { "Three" } else { "Four" })
}


Measured memory_bytes: 4352
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
h,a = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに

ans = h//a
if h%a != 0:
    print(ans + 1)
else:
    print(ans)


Measured memory_bytes: 3316
import itertools 
def solve():
    n, m, x = map(int, input().split())
    c = []
    a = []
    for _ in range(n):
        C, *A = map(int, input().split())
        c.append(C)
        a.append(A)

    ans = n*1e8
    for i in range(n):
        for j in itertools.combinations(range(n), i+1):
            cnt = [0]*m
            for k in j:
                for l in range(m):
                    cnt[l] += a[k][l]
            for s in range(m):
                if cnt[s] < x:
                    break
                if s == m-1:
                    num = 0
                    for q in j:
                        num += c[q]
                    ans = min(ans, num)
    if ans == n*1e8:
        ans = -1
            
    return ans
    

print(solve())


Measured memory_bytes: 9236
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}



int main(void){
   
long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a,b,count1=0,a2,b2;

scanf("%lld %lld",&n,&m);
if(n>=13){
    printf("%lld",m);
}else{
    if(n>=6 && n<=12){
         printf("%lld",m/2);
    }else{
        printf("0");
    }
}


return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int r,g,b,n,i,j,c=0;
  scanf("%d %d %d %d",&r,&g,&b,&n);
  for(i=0;i<=n;i++){
    if(i*r>n)continue;
    for(j=0;j<=n;j++){
      if(i*r+j*g>n)continue;
      if((n-i*r-j*g)%b==0)c++;
    }
  }
  printf("%d\n",c);
  return 0;
}


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

int main(){
  ll N;
  cin >>N;
  vector<ll> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec[i];
  }
  
  int ans=0;
  for(int i=0;i<N-2;i++){
    for(int j=i+1;j<N-1;j++){
      for(int k=j+1;k<N;k++){
        if(vec[i]<vec[j]+vec[k]){
          if(vec[j]<vec[i]+vec[k]){
            if(vec[k]<vec[j]+vec[i]){
              if(vec[i]!=vec[j] && vec[j]!=vec[k] && vec[i]!=vec[k])
              ans++;
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}

          
  
  

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
const int uchiha=1e5+5;
int arr[uchiha];
long long m=1000000007;
int main()
{
int n;
long long sum=1;
cin>>n;
for(int i=1;i<=n;i++){
    sum=(sum*i)%m;
}
cout<<sum;
}

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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  int D,E,F;
  D=max(10*A+B,10*B+A)+C;
  E=max(10*B+C,10*C+B)+A;
  F=max(10*C+A,10*A+C)+B;
  cout << max(D,max(E,F))<< endl;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		
		int inputNum = sc.nextInt();
		
		for(int i = 0;i < inputNum;i++) {
		double x1 = sc.nextDouble();
		double y1 = sc.nextDouble();
		double x2 = sc.nextDouble();
		double y2 = sc.nextDouble();
		double x3 = sc.nextDouble();
		double y3 = sc.nextDouble();
		
		calc(x1,y1,x2,y2,x3,y3);
		}

	}

	public static void calc(double x1, double y1, double x2, double y2,
			double x3, double y3) {
		double a1 = (x2 - x1) *2;
		double b1 = (y2 - y1) *2;
		double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
		double a2 = (x3 - x1) *2;
		double b2 = (y3 - y1) *2;
		double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		
		double x = (b1 * c2 -b2 * c1 ) / (a1 * b2 - a2 * b1);
		double y = (c1 * a2 -c2 * a1 ) / (a1 * b2 - a2 * b1);
		
		double a= x - x1;
		double b = y -y1;
		
		double rad = Math.sqrt((a * a) + (b * b));
		
		BigDecimal bigRad = new BigDecimal(rad);
		
		BigDecimal radius = bigRad.setScale(3, BigDecimal.ROUND_HALF_UP);
		
		System.out.printf("%.3f %.3f %.3f\n",x,y,radius);
	}

}

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

int main() {
    int N, K; cin >> N >> K;
	vector<int> p(N);
	for(int i=0; i<N; ++i) cin >> p[i];
	sort(begin(p), end(p));
	cout << accumulate(begin(p), begin(p) + K, 0) << '\n';
}


Measured memory_bytes: 3612
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

LL A[300000];
int main() {
	int N;
	cin >> N;
	REP(i, 0, 3 * N) {
		cin >> A[i];
	}

	sort(A, A + 3 * N);

	LL sum = 0;
	REP(i, 0, N) {
		sum += A[N + i * 2];
	}
	cout << sum << endl;
	return 0;
}

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

using namespace std;

int main()
{
    vector<vector<int> > arr(4,vector<int>(4,0));
    for(int i=1;i<=3;i++) {
        for(int j=1;j<=3;j++) {
          cin>>arr[i][j];
        }
    }
    bool flag = true;
    for(int i=2;i<=3;i++) {
        if((arr[i][1]-arr[1][1] != arr[i][2]-arr[1][2]) || 
            (arr[i][2]-arr[1][2] != arr[i][3]-arr[1][3]) ||
            (arr[i][1]-arr[1][1] != arr[i][3]-arr[1][3])
        ) {
            flag = false;
            break;
        }
    }
    if(flag) cout<<"Yes";
    else cout<<"No";
  return 0;
}

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

void solve(long long N, std::vector<long long> d)
{
    if (N % 2 == 0)
    {
        sort(d.begin(), d.end());
        cout << d[N / 2 + 1 - 1] - d[N / 2 - 1] << endl;
    }
    else
    {
        puts("0");
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> d(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &d[i]);
    }
    solve(N, std::move(d));
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
int main()
{
    int N;
    cin >> N;
    vector<lint> a(N);
    REP(i, N) cin >> a[i];
    bool f = true;
    REP(i, N) {
        if(a[i] != 0) {
            f = false;
            break;
        }
    }
    if(f) {
        cout << "Yes" << endl;
        return 0;
    }

    if(N%3 == 0 ) {
        vector<lint> b(3, -1);
        vector<lint> c(3, 0);
        REP(i, N) {
            bool flg = false;
            REP(j, 4) {
                if(j == 3) {
                    cout << "No" << endl;
                    return 0;
                }
                if(b[j] == -1) {
                    b[j] = a[i];
                    c[j]++;
                    flg = true;
                } else if(b[j] == a[i]) {
                    c[j]++;
                    flg = true;
                }
                if(flg) {
                    break;
                }
            }
        }
        if(c[2] == 0) {
            if(b[0] == 0) {
                if(c[1] == c[0] * 2) {
                    cout << "Yes" << endl;
                    return 0;
                } else {
                     cout << "No" << endl;
                    return 0;
                }
            } else if(b[1] == 0) {
                if(c[0] == c[1] * 2) {
                    cout << "Yes" << endl;
                    return 0;
                } else {
                     cout << "No" << endl;
                    return 0;
                }
            } else {
                cout << "No" << endl;
                return 0;
            }
        }
        REP(j, 3) {
            if(c[j] != c[0]) {
                cout << "No" << endl;
                return 0;
            }
        }
        REP(i, 32) {
            int cnt = 0;
            REP(j, 3) {
                if((b[j] >> i)&1 == 1) {
                    cnt++;
                } 
            }
            if(cnt == 1 || cnt == 3) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main {
    public static long to753(int n){
        if(n==0) return 0;
        if(n==1) return 3;
        if(n==2) return 5;
        if(n==3) return 7;
        return 10* to753(n/4) + to753(n%4);
    }
    public static boolean is753(long shichigosan){
        String S = Long.toString(shichigosan);
        return S.contains("3") && S.contains("5") && S.contains("7") && !S.contains("0");
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int ans = 0;
        for(int n=0;n<=1000000; n++){
            long shichigosan = to753(n);
            if(shichigosan >N) break;
            //System.out.print(n+" "+shichigosan);
            if(is753(shichigosan) && shichigosan <= N){
                ans++;
                //ystem.out.println("!");
            }else{
                //System.out.println("?");
            }
        }
        System.out.println(ans);
    }
}

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

#define ll long long
#define mx 100005
int ar[mx];
char ch[mx];
int n,m;
void solve()
{
   cin>>n>>m;
   int cnt=0;
   int tot=0;
   int val=4*m;

   for(int i=0;i<n;i++)cin>>ar[i],tot+=ar[i];
   val=ceil((double)tot/(double)val);
   for(int i=0;i<n;i++)
   {
       if(ar[i]>=val)cnt++;
   }
   if(cnt>=m)
   {
       printf("Yes\n");
   }
   else printf("No\n");
}
int main()
{
    int t=1;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

int n, a, b;

int main()
{
	cin >> n ;
	if (n == 1)
	{
		cout << "Hello World";
		return 0;
	}
	cin >>a >> b;
	cout << a + b;
}

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

using namespace std;

typedef unsigned long long ull;

struct record{
  ull a;
  ull b;

  bool operator<( const record& right) const{
    return a < right.a;
  }
};

int main(void){

  ull n, k;
  cin >> n >> k;
  cin.ignore();
  ull a[n], b[n];
  record s[n];
  ull i;
  for(i=0;i<n;i++){
    cin >> a[i] >> b[i];
    s[i].a = a[i];
    s[i].b = b[i];
    cin.ignore();
  }
  sort(s, s + n);

  for(i=0;i<n;i++){
    //cout << s[i].a << " " << s[i].b << endl;
    if(k <= s[i].b){
      cout << s[i].a << endl;
      return 0;
    } else k-= s[i].b;
  }

  
  return 0;
}


Measured memory_bytes: 3328
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

// 復習

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

	const int MOD = 1000000007;
	// 入力
	int h, w, k;
	cin >> h >> w >> k;

	// dp
	vector<vector<int>> dp(h + 1, vector<int>(w, 0));
	dp[0][0] = 1;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			// mask
			for (int mask = 0; mask < 1 << (w - 1); mask++) {
				// 2つの横線が繋がっているか
				bool isConnect = false;
				for (int k = 0; k < w - 2; k++) {
					if (mask & (1 << k) && mask & (1 << (k + 1))) {
						isConnect = true;
						break;
					}
				}

				if (isConnect) {
					continue;
				}

				if (j >= 1 && mask & (1 << (j - 1))) {
					// 左
					dp[i + 1][j - 1] += dp[i][j];
					dp[i + 1][j - 1] %= MOD;
				} else if (j < w && mask & (1 << j)) {
					// 右
					dp[i + 1][j + 1] += dp[i][j];
					dp[i + 1][j + 1] %= MOD;
				} else {
					// 直進
					dp[i + 1][j] += dp[i][j];
					dp[i + 1][j] %= MOD;
				}
			}
		}
	}

	// 出力
	cout << dp[h][k - 1] << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(in.readLine());
        double arr[]=new double[n+1];
        StringTokenizer st=new StringTokenizer(in.readLine());
        for(int i=1;i<=n;i++)
            arr[i]=Double.parseDouble(st.nextToken());
        double dp[][]=new double[n+1][n+1];
        dp[0][0]=1.0;
        for(int i=1;i<=n;i++){
            for(int j=0;j<=i;j++){
                if(j==0)
                    dp[i][j]=dp[i-1][j]*(1.0-arr[i]);
                else
                    dp[i][j]=dp[i-1][j-1]*arr[i]+dp[i-1][j]*(1.0-arr[i]);
            }
        }
        double ans=0.0;
        for(int i=(n+1)/2;i<=n;i++)
            ans+=dp[n][i];
        System.out.println(ans);
    }
}


Measured memory_bytes: 132688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<string> S(N);
    VI P(N);
    //vector<pair<string,int>> sp;
    pair<pair<string,int>,int> sp[110];
    REP(i,N) {
        cin >> S[i] >> P[i];
        sp[i] = make_pair(make_pair(S[i],-P[i]),i);
        //sp[i] = {S[i],P[i],i};

    }
    sort(sp,sp+N);
    REP(i,N){
        dump(sp[i].first.first);
        dump(sp[i].first.second);
    }
    REP(i,N){
        cout << sp[i].second + 1 << endl;
    }


}

Measured memory_bytes: 256
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]
AB = sorted(AB)
#print(AB)
ans = N + AB[-1][1]
for i in range(N):
  if i == 0:
    ans += AB[0][0] - 1
  else:
    ans += min(abs(AB[i][0]-AB[i-1][0])-1,abs(AB[i][1]-AB[i-1][1])-1)
print(ans)

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

int main() {
    int x,a,b;
    cin >> x >> a >> b;
    if(a >= b) cout << "delicious" << endl;
    else if(b-a <= x) cout << "safe" << endl;
    else cout << "dangerous" << endl;
}

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

int main(){
    int d,l;
    cin >> d >> l;
    int count=0;
    while(1){
        if(d/l !=0){ 
            count = d/l;
            d %= l;
        }else{
            break;
        }
    }
    while(1){
        if(d != 0){
            d-=1;
            count++;
        }else{
            break;
        }
    }

    cout << count << endl;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int data[N];

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

	//input
	for(int i = 1; i <= n; i++){
		int r, l;
		cin >> r >> l;
		for(int j = r; j <= l; j++) data[j]++;
	}

	//debug
	//for(int i = 0; i < 10; i++) cout << "arr = " << data[i] << endl;

	int ans = 0;
	vector<int> v;
	for(int i = 1; i <= N; i++){
		int ok = data[i];
		if(ok + 1 >= i) ans = max(ans, i);
	}

	cout << ans - 1 << endl;

	return 0;
}



Measured memory_bytes: 3412
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VL vector<LL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e18;
const LL INF = 1e9;

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    /*
    int t,n;
    cin>>t;
    loop(t1,1,t+1)
    {
        int a[n];
        loop(i,0,n) cin>>a[i];
    }
    */

    //cout<<MX<<'\n';
    int n;
    cin>>n;
    LL a[n], f = 0;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i] == 0) f = 1;
    }

    LL ans = a[0];
    if(f) ans = 0;
    else
    {
        loop(i,1,n)
        {
            LL lm = MX/ans;
            if(a[i] > lm) {ans = -1; break;}
            ans = ans * a[i];
        }
    }

    cout<<ans<<'\n';

    /*
    if(f) cout<<"Yes"<<'\n';
    else cout<<"No"<<'\n';
    */

    return 0;
}


Measured memory_bytes: 4424
def main():
    n = int(input())
    t0 = int(input())
    t1 = int(input())

    tmpmax = t1 - t0
    tmpmin = min(t0, t1)

    for _ in range(2,n):
        t = int(input())
        if t - tmpmin > tmpmax:
            tmpmax = t - tmpmin 
        if t < tmpmin:
            tmpmin = t
    print(tmpmax)


if __name__ == '__main__':
    main()



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

int main()
{
	string str,str1;
	cin>>str;
	cin>>str1;
	if(str1.size()!=str.size()+1)
		cout << "No" <<"\n";
	else
	{
		str1.pop_back();
		if(str==str1)
		cout << "Yes" <<"\n";
		else
			cout <<"No"<<"\n";
	}
}

Measured memory_bytes: 3604
a0 = list(input())
k = int(input())
a = a0+['O', 'O', 'O', 'O']
b = sorted(set(a0))[:3]
A = set()

for w in b:
    for i, x in enumerate(a0):
        if x == w:
            for m in range(1, 6):
                A.add(tuple([a[i+k] for k in range(m)]+['O']*(6-m)))

A = sorted(A)
j = A[k-1].index('O')
ans = list(A[k-1])[:j]
print(''.join(ans))


Measured memory_bytes: 3444
n = gets.to_i
ab = []
n.times { |i|
  ab << gets.split.map {|x| x.to_i}
}

ab.sort! {|a,b| a[1] <=> b[1]}

s = 0
ab.each { |v|
  s += v[0]
  if s > v[1]
    puts "No"
    exit
  end
}
puts "Yes"



Measured memory_bytes: 18552
# include <iostream>
# include <string>
# include <vector>


using namespace std;


const int MOD = 1e9+7;


int main() {
    string s; cin >> s;

    int n_digits = s.size();

    vector<vector<long long>> dp(n_digits+1, vector<long long>(13, 0));
    dp[0][0] = 1;  // 0 (mod 13) \equiv 0

    long long digit = 1;
    for (int i=0; i<n_digits; i++) {

        // update dp[i+1][k]
        if (s[n_digits-i-1] != '?') {
            int k = s[n_digits-i-1] - '0';
            for (int j=0; j<13; j++) {
                dp[i+1][(digit*k+j)%13] += dp[i][j];
            }
        }

        else {
            for (int k=0; k<10; k++) {
                for (int j=0; j<13; j++) {
                    dp[i+1][(digit*k+j)%13] += dp[i][j];
                }
            }
        }

        for (int k=0; k<13; k++) dp[i+1][k] %= MOD;
        digit *= 10;
        digit %= 13;
    }

    cout << dp[n_digits][5] << endl;
    return 0;
}



Measured memory_bytes: 13696
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#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()
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
using namespace std;
typedef long long ll;

void Main()
{
    string n;
    cin >> n;

    if (n == "ABC")
    {
        cout << "ARC" << endl;
    }
    else if (n == "ARC")
    {
        cout << "ABC" << endl;
    }
}

int main()
{
    std::cout << std::fixed << std::setprecision(15);
    Main();
}

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

//省略形
#define rep(i,n) for(auto i=0; i<n ; ++i)
#define REP(i,a,b) for(auto i=a; i<b; ++i)
#define all(v) (v).begin() , (v).end()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//よく使う定数
const int INF = 1e9;
const int MOD = 1e9+7;
//逆元
const int INV = 1e9+5;

//UnionFindTree
struct union_find{
  vector<int> data;
  union_find(int size) : data(size , -1) { }

  void merge(int x , int y){
    x = root(x); y = root(y);
    if(x == y) return;
    if(data[y] < data[x]) swap(x , y);
    data[x] += data[y];
    data[y] = x;
    return; 
  }

  bool same(int x , int y){
    x = root(x) , y = root(y);
    return x == y;
  }

  int root(int x){
    return data[x] < 0 ? x : (data[x] = root(data[x]));
  }

  int size(int x){
    return -data[root(x)];
  }
};

//プロトタイプ宣言
void faster(void);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);
template <class T>
T modpow(T , T , T);
bool is_palindrome(string);

//メモ
//最大公約数:__gcd　|　最小公倍数:__lcm
//回文は反転させて一致すればよい


int main(){
  int n,k,ans=0;
  cin >> k >> n;
  vi a(n),dis(n);
  rep(i,n) cin >> a[i];
  sort(all(a));
  rep(i,n-1){
    dis[i] = a[i+1] - a[i];
  }
  dis[n-1] = k - a[n-1] + a[0];
  sort(all(dis));
  rep(i,dis.size()-1){
    ans += dis[i];
  }
  cout << ans ;
}


























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//繰り返し自乗法
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 

//繰り返し自乗法(剰余)
template <class T>
T modpow(T x , T y , T mod){
  if(y == 0) return 1;
  if(y%2 == 1){
    ll temp = modpow(x,y-1,mod);
    return temp*x%mod;
  }
  else{
    ll temp = pow_mod(x,y/2,mod);
    return temp*temp%mod;
  }
}

bool is_palindrome(string s){
    string t(s.rbegin(),s.rend());
    return s == t;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if(x>=r && x+r <= W && y >=r && y+r <= H) printf("Yes\n");
    else printf("No\n");
    return 0;
}


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

int main() {
    int N, K;  cin >> N >> K;
    vector<int> H(N);
    for (int i = 0; i < N; ++i) cin >> H[i];
    sort(H.begin(), H.end(), greater<int>());
    long long ans = 0;
    for (int i = K; i < N; ++i) ans += H[i];
    cout << ans << endl;
}


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

using namespace std;
const long long maxn = 2e5+10;
const long long maxnum = 1e9;

long long n;
long long niz[maxn];

long long f(long long x) {
    long long out = 0;
    for (long long i = 0; i < n; i++)
        out += abs(niz[i] - (x + i + 1));
    return out;
}

int main() {
    scanf("%lld", &n);
    for (long long i = 0; i < n; i++)
        scanf("%lld", niz+i);

    long long lo = -maxnum, hi = maxnum;
    while (lo < hi) {
        long long mid = (lo + hi) / 2;
        if (f(mid) < f(mid + 1)) hi = mid - 1;
        else lo = mid + 1;
    }

    long long sol = (1LL << 50);
    for (int i = -5; i < 6; i++)
        sol = min(sol, f(lo + i));
    printf("%lld", sol);
    return 0;
}


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

int main()
{
  int isec;
  cin >> isec;
  if( isec < 0 or isec > 86400 ) {
    return -1;
  }

  int h, m, s;
  h = ( isec / 60 ) / 60;
  m = ( isec / 60 ) % 60;
  s = ( isec - h * 60 * 60 - m * 60 );

  cout << h << ":" << m << ":" << s << endl;
  return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,A,B;
  cin>>N>>A>>B;
  string S;
  cin>>S;
  int count_jp=0,count_al=0;
  vector<string> ans(N,"No");
  for(int i=0;i<N;i++){
    if(S.at(i)=='a' && count_jp+count_al<A+B){
      ans.at(i)="Yes";
      count_jp++;
    }
    else if(S.at(i)=='b' && count_jp+count_al<A+B && count_al<B){
      ans.at(i)="Yes";
      count_al++;
    }
  }  
  for(int i=0;i<N;i++){
  cout<<ans.at(i)<<endl;
  }
}

Measured memory_bytes: 6680
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000000
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define FORl(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORDl(i, a, b) for (ll i = (a); i >= (b); i--)
using namespace std;
int cnt[1000005];
bool nok[1000005];
int main () {
  int n;
  scanf("%d", &n);
  int mx = 0;
  FOR(i, 1, n) {
    int t;
    scanf("%d", &t);
    cnt[t]++;
    mx = max(mx, t);
  }
  int ans = 0;
  FOR(i, 1, mx) {
    if (!cnt[i]) continue;
    if (!nok[i] && cnt[i] == 1) ++ans; 
    for (int j = i; j <= mx; j += i) nok[j] = 1;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 8708
import math
n = int(input())
dist = [[0]*n for _ in range(n)]
pos = [tuple(map(int, input().split())) for _ in range(n)]
for i in range(n):
    for j in range(n):
        dist[i][j] = ((pos[i][0] - pos[j][0])**2 + (pos[i][1] - pos[j][1])**2)**0.5
from itertools import permutations
per = list(permutations([k for k in range(n)]))
count = 0
for pe in per:
    for l in range(n-1):
        count += dist[pe[l]][pe[l+1]]
ans = count/math.factorial(n)
print(ans)


Measured memory_bytes: 45680
#include <stdio.h>
#include <string.h>
int cand_cnt;
int cand[10];
int m,n;
int aster_cnt[2][10]; // [even or odd] [sum] asterisk no kanousei 

int expt(number,sisuu)
{
  if(sisuu==0)
    return(1);
  else
    return(number*expt(number,sisuu-1));
}
int sum_digits(int n,int keta,int *ret,int parity)
{
  int i,digit;

  *ret=0;

  while(keta)
    {
      digit = n % 10;

      if(cand[digit]==0)
	return(0);
      if(parity==0)
	*ret += convert_digit(digit % 10);
      else
	*ret += (digit % 10);
      *ret %= 10;
      n /= 10;
      keta--;
    }
  return(-1);
}
void count_aster(int n,int parity)
{
  int i,ret,start,try=expt(10,n);

  for(i=0;i<try;i++)
    if(sum_digits(i,n,&ret,parity))
      {
	aster_cnt[parity][ret]++;
      }
}

int convert_digit(int d)
{
      if(d<5)
	return(d*2);
      else
	return(1+((d*2)%10));
}
void dump()
{
  int i;

  for(i=0;i<10;i++)
    printf("as cnt:%d %d\n",i,aster_cnt[0][i]);
 for(i=0;i<10;i++)
    printf("as cnt:%d %d\n",i,aster_cnt[1][i]);
}
main()
{
  int i,cnt,ret,sum,chksum,try;
  int even_aster,odd_aster;

  char c;

 
  memset(cand,0,sizeof(int)*10);
  scanf("%d ",&n);
  even_aster=odd_aster=0;
  for(i=0,sum=0;i<n;i++)
    {
      scanf("%c",&c);
      if(c=='*')
	{
	  if(((n-i)%2)==0)
	    even_aster ++;
	  else
	    odd_aster  ++;
	}
      else
	{
	  if(((n-i)%2)==0)
	    {
	      sum+=convert_digit((c-'0'));
	    }
	  else
	    sum+=(c-'0');
	  //printf("%c[%d]:",c,sum);
	}
    }
  sum %= 10;
  scanf("%d ",&m);

  for(i=0;i<m;i++)
    {
      scanf("%c ",&c);
      cand[c-'0']=-1;
    }

  cnt=0;
  memset(aster_cnt,0,80);

  count_aster(even_aster,0);
  count_aster(odd_aster ,1);

  //dump();
   
  for(i=0,cnt=0;i<10;i++)
    cnt += aster_cnt[0][i]*aster_cnt[1][(20-sum-i)%10];
  printf("%d\n",cnt);
  
  return(0);
}

Measured memory_bytes: 600
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def main():
    n=int(input())
    ret = 0
    for i in range(1,n+1):
        if i%3!=0 and i%5!=0:
            ret += i
    print(ret)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9184
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
txy = [[0, 0, 0]] + txy
for i in range(1, len(txy)):
  dt = txy[i][0] - txy[i-1][0]
  dist = abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2])
  if dt < dist or dt%2 != dist%2:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 28068
#include <bits/stdc++.h>
using namespace std;
 
int main() { 
  int a , b , c , d , e ;
  cin>> a;
  e=a%10;
  d=(a%100-e)/10;
  c=(a%1000-10*b-e)/100;
  b=(a-100*c-10*b-e)/1000;
  if ((b==c&c==d)||(c==d&d==e)){
   cout << "Yes" << endl;
  }
  else{
   cout << "No" << endl;
  }
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int count = 0;
    for(int i=1;i<=n;i++){
        if(to_string(i).length()%2==1) count++;
    }
    cout << count << endl;
    return 0;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
signed main(){
  int k,x;
  cin>>k>>x;
  for(int i=x+1-k;i<x+k;i++){
    cout<<i;
    if(i != x-1+k)
      cout<<' ';
  }
  cout<<endl;
    return(0);
}


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

int main() {
  int N;
  cin >> N;
  int s =0;
  for (int i = 0; i < N; i++){
    int l,r;
    cin >>l>>r;
    s += (r-l+1);
  }
  cout << s << endl;
  
}

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

int main() {
    int n;
    cin >> n;
    set<int> st;

    rep(i ,n) {
        int tmp;
        cin >> tmp;
        st.insert(tmp);
    }

    cout << st.size() << endl;
}

Measured memory_bytes: 3552
module S = Set.Make (struct type t = int * int let compare = compare end)

let () =
    let main () =
        let h, w = Scanf.sscanf (read_line ()) "%d %d" (fun h w -> h, w) in
        let s = Array.init h (fun _ -> read_line ()) in
        let dfs x y =
            let m = Array.make_matrix h w (-1) in
            let rec loop depth next = function
                | [] -> if S.is_empty next then depth else loop (depth + 1) S.empty (S.elements next)
                | (xx, yy) :: tl ->
                        let () = m.(yy).(xx) <- depth in
                        let next = if xx > 0     && m.(yy).(xx - 1) < 0 && s.(yy).[xx-1] = '.' then S.add (xx-1, yy) next else next in
                        let next = if xx < w - 1 && m.(yy).(xx + 1) < 0 && s.(yy).[xx+1] = '.' then S.add (xx+1, yy) next else next in
                        let next = if yy > 0     && m.(yy - 1).(xx) < 0 && s.(yy-1).[xx] = '.' then S.add (xx, yy-1) next else next in
                        let next = if yy < h - 1 && m.(yy + 1).(xx) < 0 && s.(yy+1).[xx] = '.' then S.add (xx, yy+1) next else next in
                        loop depth next tl
            in
            if s.(y).[x] = '.' then loop 0 S.empty [ x, y ] else 0
        in
        let rec loop_h y acc =
            let rec loop_w x acc =
                if x = w then acc else loop_w (x + 1) (max acc (dfs x y))
            in
            if y = h then acc else loop_h (y + 1) (loop_w 0 acc)
        in
        loop_h 0 0 |> Printf.printf "%d\n"
    in
    main ()

Measured memory_bytes: 2688
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
	typedef long long int lli;
	const int MaxN=200005;
	#define fst first
	#define snd second
	int mcd(int a,int b){	
		if(a==0)return b;
		return mcd(b%a,a);
	}		
	lli pre[MaxN];
	lli suf[MaxN];	
	lli arr[MaxN];
int main(){
	lli N,K,i,j,p,q,res=1e15;
	string word;
	cin>>word;
	N=word.size();
	for(i=0;i<N/2;i++){
		if(word[i]!=word[N-i-1]){
			cout<<"No";
			return 0;
		}	
	}
	p=N/2;
	for(i=0;i<p/2;i++){
		//cout<<i<<" "<<p-i-1<<"\n";
		if(word[i]!=word[p-i-1]){
			cout<<"No";
			return 0;
		}	
	}
	cout<<"Yes";
}

Measured memory_bytes: 256