akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

#define 	pi 				3.1415926536
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(ll i = a ; i < b ; i++)
#define     repn(i, a, b)   for(ll i = a ; i > b ; i--)
#define 	mod1 			1000003
#define     mod2            998244353
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define     sz              size()
#define     len             length()
#define 	F 				first
#define 	S 				second
#define 	PB 				push_back
#define 	MP				make_pair
#define 	B 				begin()
#define     RB              rbegin()
#define 	E 				end()
#define     UB              upper_bound
#define     LB              lower_bound
#define     present(k, m)   (m.find(k)!=m.end())?1:0
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define     pll             pair<long long int, long long int>
#define     vll             vector<long long int>
#define     vpll            vector<pll>
#define 	vs 				vector<string>
#define     vc              vector<char>
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	print2(a) 		for(auto i : a)cout<<i;cout<<"\n"
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;


/*############################# DSU ##############################*/
vll parent(1e5), Size(1e5), Rank(1e5);

void make_set(ll v){
    parent[v]=v;
    Size[v] = 1;
    // Rank[v] = 0;
}
 
int find_set(ll v){
	return (parent[v]==v) ?  v : parent[v] = find_set(parent[v]);
}
 
void union_sets(ll a, ll b){
	a = find_set(a);
	b = find_set(b);
	if(a != b){
        if(Size[a] < Size[b])
            swap(a, b);
        // if(Rank[a] < Rank[b])
        //     swap(a, b);
		parent[b] = a;
        Size[a] += Size[b];
        // if(Rank[a] == Rank[b])
        //     Rank[a]++;
    }
}
/*############################# DSU ##############################*/


bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }

double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }

ll pw2[32];
void cal(){ pw2[0] = 1; rep(i, 1, 32)pw2[i] = 2*pw2[i-1]; }

/* ################################################################ */

void solve()
{
    ll n; cin>>n;
    vpll  a(n);
    map<ll, ll> s;
    rep(i, 0, n){
        cin>>a[i].F;
        a[i].S = i+1;
        s[a[i].F+a[i].S]++;
    }
    ll ans = 0;
    rep(i, 0, n){
        if(s.find(a[i].S-a[i].F)!=s.end())ans+=s[a[i].S-a[i].F];
    }
    cout<<ans<<nl;

}


int main()
{
    // boost;
    cal();
    int t = 1, k = 1;
    // cin>>t;
    while(t--){
        // cout<<"Case #"<<k<<": ";
        solve();
        k++;
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MAX=100005;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

// mod. m での a の逆元 a^{-1} を計算する
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll ncm(ll n,ll m){
    ll ans = 1;
    rep(x,m){
        ans *= (n-x);
        ans %= MOD;
        ans *= modinv(m-x,MOD);
        ans %= MOD;
    }
    return  ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,k;
    cin>>n>>m>>k;
    ll ans = 0;
    ll ansX = 0;
    ll ansY = 0;
    //X
    REP(d,1,n){
        ansX += (d*(n-d))%MOD;
    }
    ansX *= m*m;
    ansX %= MOD;
    
    //Y

    REP(d,1,m){
        ansY += (d*(m-d))%MOD;
    }
    ansY *= n*n;
    ansY %= MOD;
    
    ans = ansX+ansY;

    if(k>2){
        ans *= ncm(n*m-2,k-2);
        ans %= MOD;
    }
    
    cout<<ans<<endl;
    return  0;
}


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

int main(void){
  int m,f,r;

  while(true){
      cin >> m >> f >> r;
      if(m == -1 && f == -1 && r == -1){
          break;
      }
      if(m == -1 || f ==-1){
          cout << "F" ;
      }
      else if(m+f >= 80){
          cout << "A" ;
      }
      else if(65 <= m+f && m+f < 80){
          cout << "B" ;
      }
      else if(50 <= m+f && m+f < 65){
          cout << "C" ;
      }
      else if(30 <= m+f && m+f < 50){
          if(r >= 50){
              cout << "C" ;
          }
          else{
              cout << "D" ;
          }
      }
      else{
          cout << "F" ;
      }
      cout << endl;
  }
}


Measured memory_bytes: 3104
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)

#define PB push_back
#define SZ(x) ((int)(x).size())

using namespace std;

typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<int> > VVi;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }

int n;
Vs vs, vt;

int main()
{
	cin >> n;
	REP(_i, n)
	{
		string s, t;
		cin >> s >> t;
		vs.PB(s);
		vt.PB(t);
	}

	REP(_i, n)
	{
		string& s = vs[_i];
		string& t = vt[_i];
		
		VVi dp(SZ(s) + 1, Vi(SZ(t) + 1, 0));

		REP(i, SZ(s))
			REP(j, SZ(t))
		{
			chmax(dp[i + 1][j + 1], dp[i][j + 1]);
			chmax(dp[i + 1][j + 1], dp[i + 1][j]);
			if (s[i] == t[j])
				chmax(dp[i + 1][j + 1], dp[i][j] + 1);
		}

		cout << dp[SZ(s)][SZ(t)] << endl;
	}


}


Measured memory_bytes: 6856
#include <iostream>

using namespace std;

int main(void) {
    int date[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int a, b;

    cin >> a >> b;

    if (a <= b) {
        cout << a << endl;
    }
    else {
        cout << a-1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#pragma region Macros
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________

int n, m, k, i;
constexpr int N = 200010;
int a[N], b[N];
constexpr int sz = 5000000;
char reader[sz];
char *pos = reader;
int nn, now, ans;
int kk;
main() {
    reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
    while('0' <= *pos) n = n * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) m = m * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) k = k * 10 + *pos++ - '0';
    nn = n;
    pos++;
    rep(i, n) {
        while('0' <= *pos) a[i + 1] = a[i + 1] * 10 + *pos++ - '0';
        pos++;
        a[i + 1] += a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while('0' <= *pos) pos++;
                pos++;
            }
            break;
        }
    }
    while(*pos and *pos <= 32) pos++;
    rep(i, m) {
        while('0' <= *pos) b[i + 1] = b[i + 1] * 10 + *pos++ - '0';
        pos++;
        b[i + 1] += b[i];
        if(b[i + 1] > k) {
            m = i;
            break;
        }
    }
    now = ans = nn;
    for(i = 1; i <= m; i++) {
        kk = k - b[i];
        while(a[now] > kk) now--;
        ans = max(ans, i + now);
    }
    pos = reader;
    i = 0;
    do {
        *pos++ = ans % 10 + '0';
        ans /= 10;
        i++;
    } while(ans);
    reverse(reader, reader + i);
    fwrite(reader, sizeof(char), sizeof(char) * i, stdout);
}


Measured memory_bytes: 7880
n=int(input())
a=[]
b=[]
for i in range(n):
    c,d=input().split()
    a.append(c)
    b.append(int(d))
s=input()
q=a.index(s)
res=0
# print(q)
# print(a,s)
for i in range(n-q-1):
    res+=b[q+1+i]
print(res)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>
#define INF 1e+18
#define int long long
using namespace std;

struct edge{ int to,cost; };
typedef pair<int,int> P;

int n,k;
int d[100];
vector<edge> G[100];

void dijk(int x){
	for(int i = 0;i < n;i++) d[i] = INF;
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,x));
	d[x] = 0;
	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;
				que.push(P(d[e.to],e.to));
			}
		}
	}
}

signed main(){
	while(1){
		cin >> n >> k;
		if(!n) break;
		for(int i = 0;i < 100;i++){
			G[i].clear();
		}
		for(int i = 0;i < k;i++){
			int f;
			cin >> f;
			if(f == 1){
				int c,d,e;
				cin >> c >> d >> e;
				G[c - 1].push_back({d - 1,e});
				G[d - 1].push_back({c - 1,e});
			}else{
				int a,b;
				cin >> a >> b;
				dijk(a - 1);
				if(d[b - 1] == INF) cout << -1 << endl;
				else cout << d[b - 1] << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3156
N, C, K = map(int, input().split())
P = [int(input()) for _ in range(N)]
P.sort()
ans = 1
p_cnt = 0
last_b = P[0]
for p in P:
  if p <= last_b+K and p_cnt < C:
    p_cnt += 1
  else:
    last_b = p
    p_cnt = 1
    ans += 1
print(ans)


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

int main() {
  long long a,b,n,x,ans_x = 0,ans_y=0,y;
  cin >> a >> b >> n;

  long long t = max(n-10000000,(long long)0);
 
  for (x = n; x > t; x--) {
    ans_x = max(a*x/b-x/b*a,ans_x);
  }

  for (int j = 1; j < 100000000; j++) {
  y = n - n%b - j;
  ans_y = max(a*y/b-y/b*a,ans_y);
  }
  cout << max(ans_x,ans_y) << endl;
}




Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <limits>
#include <algorithm>

using namespace std;

struct Info
{
    int color;
    int cost;
};

int D[30][30];
int c[500][500];

int main()
{
    int N, C;

    cin >> N >> C;
    for (int i = 0; i < C; i++)
        for (int j = 0; j < C; j++)
        {
            cin >> D[i][j];
        }

    for (int i = 0; i < N; i++)
        for (int j = 0; j < N; j++)
        {
            cin >> c[i][j];
            c[i][j]--;
        }

    Info cand[3][4];
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 4; j++)
        {
            cand[i][j] = {0, numeric_limits<int>::max()};
        }

    for (int col = 0; col < C; col++)
    {
        Info tmp[3];
        for (int i = 0; i < 3; i++)
        {
            tmp[i].color = col;
            tmp[i].cost = 0;
        }

        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++)
            {
                int fromCol = c[i][j];
                tmp[(i + j + 2) % 3].cost += D[fromCol][col];
            }

        for (int i = 0; i < 3; i++)
        {
            cand[i][3] = tmp[i];
            sort(cand[i], cand[i] + 4, [](const auto &lh, const auto &rh) {
                return lh.cost < rh.cost;
            });
        }
    }

    int smin = numeric_limits<int>::max();
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            for (int k = 0; k < 3; k++)
            {
                Info c0 = cand[0][i];
                Info c1 = cand[1][j];
                Info c2 = cand[2][k];
                if (c0.color != c1.color && c1.color != c2.color && c2.color != c0.color)
                {
                    int s = c0.cost + c1.cost + c2.cost;
                    smin = min(smin, s);
                }
            }

    cout << smin << endl;

    return 0;
}

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

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N; cin >> N;
  int x; cin >> x;

  if(N == 2){
	if(x == 2){
	  cout << "Yes" << endl;
	  FOR(i,1,4) cout << i << endl;
	}
	else
	  cout << "No" << endl;
  }
  else{
	int mx = 2*N-1;
	if(x == 1 || x == mx){
	  cout << "No" << endl;
	}
	else{
	  VI ans(mx+1, -1);
	  vector<bool> use(mx+2, false);
	  use[x] = use[x+1] = use[x+2] = use[x-1] = true;
	  if(x > 1) use[x-2] = true;
	  if(x+2 <= mx) ans[mx/2-2] = x+2;
	  ans[mx/2-1] = x-1;
	  ans[mx/2] = x;
	  ans[mx/2+1] = x+1;
	  if(2 < x) ans[mx/2+2] = x-2;
	  
	  int it = 1;
	  for(int i=0;i<mx;++i){
		if(ans[i] != -1) continue;
		while(use[it]) ++it;
		ans[i] = it++;
	  }

	  cout << "Yes" << endl;
	  REP(i,mx) cout << ans[i] << endl;
	}
  }
  
  return 0;
}


Measured memory_bytes: 2432
X, K, D = map(int, input().split())

cnt = X // D
ans1 = X - cnt * D
ans2 = abs(ans1 - D)

if abs(cnt) < K:
  if (K - abs(cnt))%2 == 0:
    print(ans1)
  else:
    print(ans2)
else:
  if X >= 0:
    print(X - K * D)
  else:
    print(abs(X + K * D))

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

int main(){
    int i, count, max;
    string s;

    cin >> s;

    i=0;
    max=0;
    count = 0;
    while(i<s.length()){
        if(s[i]=='A' || s[i]=='T' || s[i]=='C' || s[i]=='G'){
            count++;
            if(max<count) max = count;
        }
        else{
            count = 0;
        }

        i++;
    }

    cout << max << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const int N = 1e6 + 5, mod = 1e9 + 7;

int freq[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int g = 0;
    bool found = 0;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        g = __gcd(g, x);
        for(int j = 2; j * j <= x; j++){
            int c = 0;
            while(x % j == 0){
                x /= j;
                c++;
            }
            if(c){
                if(freq[j]) found = 1;
                freq[j] = 1;
            }
        }
        if(x != 1){
            if(freq[x]) found = 1;
            freq[x] = 1;
        }
    }
    if(!found) cout << "pairwise coprime";
    else{
        if(g == 1) cout << "setwise coprime";
        else cout << "not coprime";
    }

    return 0;
}


Measured memory_bytes: 7508
//Never stop trying
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;

typedef pair<int,int> pi;
#define fi first
#define se second

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;

#define pb push_back
#define eb emplace_back
#define pf push_front

#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

const int MOD = 1e9+7; //998244353
const ll INF = 1e18;
const int nx[4]={0,0,1,-1}, ny[4]={1,-1,0,0}; //right left down up

void IO(){
#ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
#endif 
}

int32_t main(){
   boost;
   IO();

   int N,D; cin>>N>>D;
   int ans=0;
   for(int i=0; i<N; i++){
   	int x,y; cin>>x>>y;
   	ld d=sqrt(x*x+y*y);
   	if(d<=D)ans++;
   }

	cout << ans << endl;
	

   return 0;
}



Measured memory_bytes: 3696
import java.util.*;
public class Main{


public static void main (String []args)
{
	Scanner scan=new Scanner(System.in);
	//long t=scan.nextLong();
	//long ways[]=new long[1000000000];
	//ways[1]=1;
	//ways[i]=ways[i-1]*2;
	
	//while(t-->0){
         int n=scan.nextInt();
         int weight=scan.nextInt();
         int w[]=new int[n];
         long v[]=new long[n];
         // int c[]=new int[n];
        // int dp[]=new int[n];
        for(int i=0;i<n;i++)
       {  w[i]=scan.nextInt();
          v[i]=scan.nextLong();
         // c[i]=scan.nextInt();
       }
       
	long dp[][]=new long[n][weight+1];
	for(int j=1;j<=weight;j++)
		{  
			if(j<w[0])
			dp[0][j]=0;
			else 
			dp[0][j]=v[0];
			}
        
	for(int i=1;i<n;i++)
	{
		for(int j=1;j<=weight;j++)
		{  
			if(j<w[i])
			dp[i][j]=dp[i-1][j];
			else 
			dp[i][j]=Math.max(dp[i-1][j-w[i]]+v[i],dp[i-1][j]);
			}
		}
	
	
         
         System.out.println(dp[n-1][weight]);
//}//
}
}


Measured memory_bytes: 125652
#include "bits/stdc++.h"
using namespace std;
int main() {
	string S;
	cin >> S;
	for (int i = S.size(); i >= 2; i--) {
		if (i % 2 != 0) continue;
		int j = i / 2;
		int num = 0;
		for (int k = 0; k < i / 2; k++) {
			if (S.at(j) != S.at(k)) num++;
			j++;
		}
		if (num == 0 && i != S.size()) {
			cout << i << endl;
			return 0;
		}
	}
}


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

h = []
for i in range(n):
    h.append(int(input()))

l = [0]
h.sort()


t = max(h)

for i in range(n-(k-1)):
    if(h[i+(k-1)] - h[i] < t):
        t = h[i+(k-1)] - h[i]

print(t)

Measured memory_bytes: 7384
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
inline int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int k;
int x=7;
int cnt;
map<int,bool>mp;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>k;
	if(!(k&1)){
		cout<<-1;
		return 0;
	}
	while(x%k){
		x%=k;
		if(mp[x]){
			cout<<-1;
			return 0;
		}
		mp[x]=1;
		x=x*10+7;
		cnt++;
	}
	cout<<cnt+1;
	return 0;
}



Measured memory_bytes: 50452
#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()
using namespace std;
typedef long long ll;
int main()
{
  cout<<fixed<<setprecision(10);
  long double sum=0;
  int N;
  cin >> N;
  vector<vector<long double>> data(N, vector<long double>(2));
  REP(i,N) REP(j,2) cin >> data.at(i).at(j);
  REP(i,N-1) FOR(j,i+1,N) sum += sqrt(pow(data.at(i).at(0)-data.at(j).at(0),2)+pow(data.at(i).at(1)-data.at(j).at(1),2));
  cout<<std::fixed<<std::setprecision(10) << sum * (N-1) * 2 / N /(N-1) << endl;
}

Measured memory_bytes: 256
// to format a document: ctrl + K -> ctrl + D

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> x(N);
    for (auto& i : x) cin >> i;

    int ans = 9999999999;
    for (int i = 0; i < N - K + 1; i++) {
        int tmp = 0;
        if (0 <= x[i] || x[i + K - 1] <= 0)
            tmp = max(abs(x[i + K - 1]), abs(x[i]));
        else
            tmp = min(-x[i], x[i + K - 1]) * 2 + max(-x[i], x[i + K - 1]);
        ans = min(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
const int Max = 1e5 + 5;

int main() {
    //  ios_base::sync_with_stdio(0); 
      //cin.tie(0); 
      //cout.tie(0);
      //freopen("input.txt", "r", stdin);
      //freopen("output.txt", "w", stdout);
    int T = 1;

    //      scanf("%d", &T);
    while (T--) {
        int a, b;
        cin >> a >> b;
        cout << (a + b) % 24 << endl;









    }

    return 0;
}


Measured memory_bytes: 3620
from bisect import bisect_left, bisect
n, l, t = map(int, input().split())
ants = [list(map(int, input().split())) for _ in range(n)]
bnts = []
diff = []

for i in range(n):
	x, w = ants[i][0], 3 - 2*ants[i][1]
	bnts.append((x + t*w) % l)
	if i == 0:
		zero = bnts[-1]
	if ants[i][1] != ants[0][1]:
		if ants[0][1] == 1:
			diff.append(x - ants[0][0])
		else:
			diff.append(l - (x - ants[0][0]))

bnts.sort()
num = 0
quo, mod = t//l, t%l
num += quo * len(diff) * 2
diff.sort()
diff += [d+l for d in diff]
#num += bisect_left(diff, mod*2)
num += bisect(diff, mod*2)
num %= n
for i in range(n):
	if bnts[i] == zero:
		if ants[0][1] == 1:
			true_zero = (i-num) % n
		else:
			if i < n-1:
				if bnts[i+1] == zero:
					#pass
					num -= 1
			true_zero = (i+num) % n

ans = bnts[true_zero:] + bnts[:true_zero]
print(*ans, sep="\n")

Measured memory_bytes: 35692
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 = sc.nextInt();
    if((a < c && c < b) || (b < c && c < a)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


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

int main(){
  string s;
  cin>>s;
  bool coffee=true;
  if(s[2]==s[3]&&s[4]==s[5]){
    coffee=false;
  }
  if(coffee){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
  cin.get();
  return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;

struct Tree {
    vector<map<int,int>> d;
    vector<int> c;

    Tree(int i) : d(i+1),c(i+1,-1) {}


    void color(int x,int p) {

        for (auto t : d[x]) {
            if (t.first == p) continue; 
            int next = t.first;
            c[next] = (c[x] + t.second) % 2;
            color(next,x);
        }
    }

    void add(int x, int y, int w) {
        d[x][y] = w % 2;
        d[y][x] = w % 2;
    }


};

int main(void)
{
    IOS
    int n; cin >> n;
    vector<int> v1(n,0), v2(n,0), w(n,0);
    Tree t(n);
    REP(i,n) {
        cin >> v1[i] >> v2[i] >> w[i];
        t.add(v1[i], v2[i], w[i]);
    }

    t.c[1] = 0;
    t.color(1,0);
    FOR(i,1,n+1) cout << t.c[i] << endl;

    return 0;
}


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

int main(){
    long long n;cin>>n;
    long long acc = 0;
    long long max_num;
    for (long long i=1;i<=n;i++){
        acc += i;
        if (acc >= n){
            max_num = i;
            break;
        }
    }
    cout << max_num << endl;
    n -= max_num;

    for (long long i=max_num-1;i>0;i--){
        if (n  == 0){
            return 0;
        }
        if (n - i >= 0){
            cout << i << endl;
            n -= i;
        }
    }
}

Measured memory_bytes: 256
import math

class abc_163:
    
    def __init__(self):
        pass
    
    def A(self):
        r=int(input())
        print(2*math.pi*r)
    
    def B(self):
        NM=list(map(int,input().split()))
        A=list(map(int,input().split()))
        
        if NM[0]-sum(A)>=0:print(NM[0]-sum(A))
        else:print("-1")
    
    def C(self):
        N=int(input())
        A=list(map(int,input().split()))
        ans_list=[0]*(N+1)
        
        for i in range(N-1):ans_list[A[i]] +=1
        for i in range(1,N+1):print(ans_list[i])
    
if __name__=='__main__':
    obj=abc_163()
    obj.C()

Measured memory_bytes: 33652
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 1
mod = 10**9 + 7
c = 0
z = 0
for i in a:
    if i < 0:
        c += 1
    elif i == 0:
        z += 1
if c == n and k & 1:
    a.reverse()
    for i in range(k):
        ans *= -a[i]
        ans %= mod
    print(-ans % mod)
elif c == n:
    for i in range(k):
        ans *= -a[i]
        ans %= mod
    print(ans)
elif k == n:
    for i in a:
        ans *= abs(i)
        ans %= mod
    print(((-1)**(c & 1) * ans) % mod)
else:
    plus = [i for i in a if i > 0]
    minus = [i for i in a if i <= 0]
    plus.sort(reverse=1)
    minus.sort()
    plus += [0] * z
    x = len(plus)
    y = len(minus)
    p, m = 0, 0
    if k & 1:
        ans *= plus[0]
        p += 1
    for i in range(k // 2):
        if x - 1 <= p:
            ans *= minus[m] * minus[m + 1]
            m += 2
        elif y - 1 <= m:
            ans *= plus[p] * plus[p + 1]
            p += 2
        else:
            if minus[m] * minus[m + 1] >= plus[p] * plus[p + 1]:
                ans *= minus[m] * minus[m + 1]
                m += 2
            else:
                ans *= plus[p] * plus[p + 1]
                p += 2
        ans %= mod

    print(ans % mod)


Measured memory_bytes: 31676
x, y, a,b, c = map(int, input().split())
P = list(map(int, input().split())); P.sort(); P.reverse()
Q = list(map(int, input().split())); Q.sort(); Q.reverse()
R = list(map(int, input().split())); R.sort(); R.reverse()

ans = P[:x] + Q[:y] + R
ans.sort(); ans.reverse()
ans = ans[:(x + y)]

print (sum(ans))



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

int main() {
    int n, t;
    cin >> n >> t;
    vector<pair<int, int>> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p.at(i).first >> p.at(i).second;
    }
    //sort(p.begin(), p.end());//cost降順
    int mincos=1001;
  	int index;
    for(int i = 0; i < n; i++) {
      	int tmp = mincos;
        if(p.at(i).second <= t) mincos = min(mincos, p.at(i).first);
      	if(tmp!=mincos) index=i;
      //cout<<p.at(i).first<<' '<<p.at(i).second<<endl;;
    }
    mincos==1001 ?
    cout << "TLE" << endl:
    cout << p.at(index).first << endl;
}

Measured memory_bytes: 256
/*
 * @Author: RBQRBQ
 * @Date: 2020-04-17 00:12:29
 * @LastEditors: RBQRBQ
 * @LastEditTime: 2020-04-18 00:32:22
 */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef pair<int,int> pii;
namespace IO{
    template<typename T>inline void read(T &x){
        x=0;ll f=1;char ch=getchar();
        while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
        while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
        x=x*f;
    }
}
using namespace IO;
const int maxn =200000;
int f[maxn+10];
int find(int x)
{
    if(f[x]==x) return x;
    else
    {
        f[x]=find(f[x]);
        return f[x];
    } 
}
int N;
ll M;
ll Q;
vector<pii> p1;
vector<pii> p2;
signed main()
{
    for(int i=0;i<=maxn;i++)
    f[i]=i;
    read(N),read(M),read(Q);
    ll pos=0;
    for(int i=1;i<=Q;i++)
    {
        int x,y,k;
        read(x),read(y),read(k);
        if(k==0) p1.push_back(make_pair(x,y));else p2.push_back(make_pair(x,y));
        if(k==0){
        int f1=find(x);
        int f2=find(y);
        if(f1!=f2) {
        pos++;
        f[f1]=f2;}
        }
    }
    ll cnt=0;
    if(M==N-1)
    {
        if(p2.size()!=0){
        cout<<"No";return 0;}
    }
    for(int i=0;i<N;i++)
    if(find(i)==i) cnt++;
    ll que=0;
    for(auto p:p2)
    {
        if(find(p.second)==find(p.first))
        {
            cout<<"No";
            return 0;
        }
    }
    if(cnt<=2)
    {
        
        if(p2.size()!=0)
        {
            cout<<"No";
            return 0;
        }
        else
        {
            if(cnt==1&&M>pos) {cout<<"No"; return 0;}
            if(cnt==2&&M>pos+1){cout<<"No"; return 0;}
            cout<<"Yes";
            return 0;
        }
    }
    else
    {
        ll ans=(1ll*cnt*(cnt-1))/2;
        
        if(((M-1ll*pos)>ans))
        {
            cout<<"No";
            return 0;
        }
        else
        {
            cout<<"Yes";
            return 0;
        }
        
    }
}


Measured memory_bytes: 4724
n=int(input())
b=list(map(int,input().split()))
ans=[]
while True:
      for i in range(len(b)-1,-1,-1):
            if b[i]>i+1:
                  print(-1)
                  exit()
            if b[i]==i+1:
                  ans.append(b[i])
                  c=b[i+1:]
                  b=b[:i]
                  b[len(b):len(b)]=c
                  break
      if len(b)==0:
            break
for _ in range(n):
      print(ans.pop())



Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-ffloat-store")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define f(i,a,b) for(int i=a;i<b;i++)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define mod 1000000007
#define inf  1e18
#define ps(x,y)   fixed<<setprecision(y)<<x
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define inp(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main() 
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
    FIO;
    ll n;
    cin>>n;
    if(n>=30)
    cout<<"Yes"<<endl;
    else 
    cout<<"No"<<endl;
return 0;   
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;
const double PI = acos(-1.0);


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * b / g;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

using Graph = vector<VE>;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	double a, b, x; cin >> a >> b >> x;
	double v = a * a*b;
	double now = 0;
	if (2 * x < v) {
		now = a * b*b / (2 * x);
	}
	else {
		now = 2 * (v - x) / (a*a*a);
	}
	cout << fixed << setprecision(15) << atan(now)*180.0 / PI << endl;
	return 0;
}

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

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

    int ans = 0;
    for(int i = 0; i <= n - 3; i++){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') ans++;

    }
    cout << ans << endl;

    return 0;
}

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

public class Main {
    public static void main(String[] args){
        int[] a = new int[10];
        Scanner sc = new Scanner(System.in);
        for (int i=0; i<10; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(a);
        for (int i=9; i>6; i--) {
            System.out.printf("%d\n",a[i]);
        }
    }
}



Measured memory_bytes: 26136
#include<bits/stdc++.h>
using namespace std;
#define mod 998244353
#define nn 200008
#define ll long long
int len[nn];int n;
map<int,int> m;
int tms=0;
int add(int x,int A)
{
	int y=x;
	while(m[x]>=A-1 and x>0) x--,tms++;
	if(!x) return 0;
	map<int,int>::iterator it=m.upper_bound(x),itt;
	while(it!=m.end()) itt=it,++it,m.erase(itt),tms++;
	m[x]++;return 1;
}
int check(int A)
{
	m.clear();tms=0;
	if(A==1)
	{
		for(int i=2;i<=n;i++)
		{
			if(len[i]<len[i-1]) return 0; 
		}return 1;
	}
	for(int i=2;i<=n;i++)
	{
		if(len[i]>len[i-1]) continue;
		else 
		{
			if(add(len[i],A)==0) return 0;
		}
	}
	return 1;
}
int main()
{	
	cin>>n;for(int i=1;i<=n;i++) scanf("%d",&len[i]);
	int l=1,r=n;int ans=0;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(check(mid))
			ans=mid,r=mid-1;
		else l=mid+1;
		//if(tms>n*4) assert(0);
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+7;
int a[N],b[N],g,m,n,l = 1e9+7,r,mid;
int main() {
	scanf("%d",&n);
	for(int i=1; i<=2*n-1; i++) {
		scanf("%d",&a[i]);
		l=min(l,a[i]);
		r=max(r,a[i]);
	}
	while (l <= r) {
		mid = l + r >> 1;
		int f = 1e8 + 7,q = 1e8 + 7, cnt = 0;
		for(int i=1; i<=2*n-1; i++)
			if(a[i]>=mid)b[i]=1,cnt++;
		for(int i=n+1,j=n-1; i<=n*2-1&&j>=1; i++,j--) {
			if(b[j]==0&&b[j+1]==0)f=min(f,n-j);
			if(b[i]==0&&b[i-1]==0)f=min(f,i-n);
			if(b[j]==1&&b[j+1]==1)q=min(q,n-j);
			if(b[i]==1&&b[i-1]==1)q=min(q,i-n);	
		}
		if(q<f)l=mid+1;
		else if(q>f) r=mid-1;
		else {
			if(cnt>=n)l=mid+1;
			else r=mid-1;
		}
		memset(b, 0, sizeof b);
	}
	printf("%d",r);
}

Measured memory_bytes: 6400
#[warn(unused_imports)]
use proconio::{
   fastout, input,
   marker::Usize1
};
use std::cmp::max;

#[fastout]
fn main() {
   input! {
      n: usize, m:usize, q:usize,
      mut abcd: [(Usize1, Usize1, usize, usize); q]
   }
   let mut ans = 0;
   dfs(1, &mut Vec::new(), n, m, &abcd, &mut ans);
   println!("{}", ans);
}

fn dfs(i:usize, ax:&mut Vec<usize>, n:usize, m:usize, abcd: &[(usize, usize, usize, usize)], ans: &mut usize) {
   ax.push(i);
   if ax.len() == n {
      let mut x = 0;
      for (a, b, c, d) in abcd.iter() {
         if ax[*b] - ax[*a] == *c {
            x += d;
         }
         if x > *ans {
            *ans = x;
         }
      }
   } else {
      for j in i..=m {
         dfs(j, ax, n, m, abcd, ans);
      }
   }
   ax.pop();
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  if (s=="SUN")
  {cout<<7;
  }
  else if (s=="MON")cout<<6;
  else if (s=="TUE")cout<<5;
  else if (s=="WED")cout<<4;
  else if (s=="THU")cout<<3;
  else if (s=="FRI")cout<<2;
  else if (s=="SAT")cout<<1;
  
  
  


}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
  int N, H;
  cin >> N >> H;
  vector<int> a(N), b(N);
  int max_a = 0;
  for (int i = 0; i < N; i++)
  {
    cin >> a[i] >> b[i];
    if (max_a < a[i])
      max_a = a[i];
  }
  sort(b.rbegin(), b.rend());
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    if (max_a < b[i])
    {
      H -= b[i];
      ans++;
      if (H <= 0)
      {
        cout << ans << endl;
        return 0;
      }
    }
  }
  ans += (H + max_a - 1) / max_a;
  cout << ans << endl;
  return 0;
}

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

//そのまま再帰にかけて実行しては間に合わない。先に各部分木の根に対して、子に分配する数値を加算しておき、
//根である1から子に対して、根の数値を加算していく作業を一回だけ行えば条件は満たされる

void DFS(const Graph &G,int v,vector<bool> &seen,vector<int> &counter){//深さ優先探索。
//引数は順にグラフ、始点(注目点)、探索済みかどうか、各点の持つ値を記録するカウンタ
  
  seen[v]=true;

  for(auto next_v : G[v]){
    if(seen[next_v]) continue;
    counter[next_v]+=counter[v];
    DFS(G,next_v,seen,counter);
  }

  return ;

}

 
int main() {

  int N , Q ;  cin >> N >> Q ;

  Graph G(N+1);//頂点はn個。今回は数値にそのまま対応させるために+1した

  rep(i,N-1){
    int a,b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }//入力終了

  vector<int> p(Q),x(Q);

  rep(i,Q) cin >> p[i] >> x[i];

  vector<bool> seen(N+1,false);
  vector<int> counter(N+1,0);

  rep(i,Q) counter[p[i]]+=x[i];

  DFS(G,1,seen,counter);  

  for(int i=1;i<=N;i++){
    cout << counter[i] <<' ';
  }

  cout << endl;

  return 0;
}

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

void Main() {
  int N, M;
  cin >> N >> M;

  int a = 1;
  int b = (M / 2) * 2 + 1;
  int c = b + 1;
  int d = b + (M - (M / 2)) * 2;
  for (int i = 0; i < M / 2; i++) {
    cout << a + i << " " << b - i << endl;
  }
  for (int i = 0; i < M - (M / 2); i++) {
    cout << c + i << " " << d - i << endl;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int n, A;
long long F[N*N][N] = {0};

int main() {
    cin >> n >> A;
    F[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        for (int j = 2500; j >= x; j--) {
            for (int k = n; k >= 1; k--)
            if (F[j-x][k-1]) F[j][k] += F[j-x][k-1];
        }
    }
    long long res = 0;
    for (int i = 1; i <= n; i++) {
        int j = i*A;
        res += F[j][i];
    }
    cout << res << endl;
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main(void){
    int N,i;
    double t,x,h,height,ans;
    cin>>N>>t;
    for(int i=0;i<N;i++){
        cin>>x>>h;
        height=(h*t)/x;
        if(ans<=height){
            ans=height;
        }
    }
    printf("%f", ans);
}



Measured memory_bytes: 3296
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int c1, c5, c10, c50, c100, c500;
		
		c1 = scan.nextInt();
		c5 = scan.nextInt();
		c10 = scan.nextInt();
		c50 = scan.nextInt();
		c100 = scan.nextInt();
		c500 = scan.nextInt();
		
		if(c1 + c5*5 + c10*10 + c50*50 + c100*100 + c500*500 >= 1000)
			System.out.println(1);
		else System.out.println(0);
	}
}

Measured memory_bytes: 26228
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{   
   ll n,k;
   cin>>n>>k;
   ll ar[n+1];ar[0]=0;
   int j=1;
    for(ll i=1;i<=n;i++)
       {
           cin>>ar[i];
           if(i>k)
             {
                 if(ar[i]>ar[j])
                    cout<<"Yes"<<endl;
                    else cout<<"No"<<endl;
                 j++;
             }
       }
       
}


Measured memory_bytes: 5196
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1e15
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 1e5 + 2;
ll a,b,c,k;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>a>>b>>k;
    for(ll i = min(a,b);i >= 1;--i) if(a % i == 0 && b % i == 0){
        c += 1;
        if(c == k){
            cout<<i;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// Package main provides
//
// File:  b.go
// Author: ymiyamoto
//
// Created on Thu Jan 10 22:31:09 2019
//
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)

	arr := make([]int, N)
	for i := range arr {
		fmt.Scan(&arr[i])
	}
	sort.Ints(arr)

	ans := 0
	for i := 0; i < K; i++ {
		ans += arr[len(arr)-1-i]
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-08-07 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

template<class T> ll upper(T n,T m){return (n+m-1)/m;};
template<class T> ll rounding(T n){return (long double)n+0.5;};

template<class T> bool inG(T x,T n){return 0<=x && 0<n;}
template<class T> bool outG(T x,T n){return x<0 || n<=x;}

inline int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int n;
  cin>>n;

  vi a(n);
  cin>>a;

  cout<<*max_element(ALL(a))-*min_element(ALL(a))<<endl;
  return 0;

}


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

typedef long long ll;
typedef pair<int, pair<int, int>> piii;
//loop
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//STL
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

//const
#define MOD 1000000007 //10^9+7:合同式の法

//acronym
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

const int INF = 1e9;

#define deg_to_rad(deg) ((deg)*M_PI / 180.0)

// const int MOD = 998244353;

void Main()
{
    vector<string> C(2);
    cin >> C.at(0);
    cin >> C.at(1);

    if (C.at(0).at(0) == C.at(1).at(2) && C.at(0).at(1) == C.at(1).at(1) && C.at(0).at(2) == C.at(1).at(0))
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int a, b;

	cin>> a >> b;

	if (a <= b) {
		for(int i=0;i<b;i++) cout << a;
	}
	else {
		for (int i = 0;i<a;i++) cout << b;
	}

	cout<< endl;


}


Measured memory_bytes: 256