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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

#define INF 1e9
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (n); i++)
#define each(x, v) for (auto& x: (v))
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl

void solve();
void in(){} template<class T, class... U> void in(T &t, U &...u){ cin >> t; in(u...); }
int main() { cin.tie(0); ios::sync_with_stdio(0); solve(); }

void solve() {
  int N;
  in(N);
  vi X(N);
  each(x, X) {
    in(x);
  }

  sort(all(X));

  int ans = INF;
  vi dp(X.back() - X[0] + 1, -1);

  for (int i = X[0]; i <= X.back(); i++) {
    int sum = 0;
    each(x, X) {
      int d = abs(i - x);
      if (dp[d] < 0) {
        dp[d] = pow(d, 2);
      }
      sum += dp[d];
    }
    ans = min(ans, sum);
  }

  print(ans);
}


Measured memory_bytes: 256
object Main extends App {

  val N = io.StdIn.readLine.toInt
  val h = io.StdIn.readLine.split(' ').map(_.toInt)

  var num = 0

  val ms = (1 until h.size).filter{i =>
    (0 to i-1).forall(j => h(j) <= h(i))
  }.size

  println(ms + 1)
}

Measured memory_bytes: 25528
def solve():
    from sys import stdin
    f_i = stdin
    
    N, M = map(int, f_i.readline().split())
    
    digits = [False] * N
    
    for i in range(M):
        s, c = f_i.readline().split()
        s = int(s)
        if digits[s-1] and digits[s-1] != c:
            return -1
        else:
            digits[s-1] = c
    
    if N == 1:
        if digits[0]:
            return digits[0]
        else:
            return 0
    
    if digits[0] == '0':
        return -1
    
    if digits[0] == False:
        digits[0] = '1'
    
    for i, d in enumerate(digits[1:], start=1):
        if d == False:
            digits[i] = '0'
    
    ans = ''.join(digits)
    return ans

print(solve())

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

class UnionFind {
public:
    vector <int> par;
    vector <int> siz;

    UnionFind(int sz_): par(sz_), siz(sz_, 1LL) {
        for (int i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(int sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (int i = 0; i < sz_; ++i) par[i] = i;
    }

    int root(int x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

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

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

signed main() {
  int N, M;
  cin >> N >> M;

  UnionFind uf(N);

  REP(i, M){
    int x, y, z;
    cin >> x >> y >> z;
    x--; y--;
    uf.unite(x, y);
  }

  int ans = 0;
  REP(i, N){
    if(uf.root(i) == i) ans++;
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 1792
# coding: utf-8
N, M = map(int, input().split())
graph = [[False for i in range(N)] for j in range(N)]
visited = [False for i in range(N)]
def dfs(v):
    visited[v] = True
    for k in range(N):
        if not graph[v][k]:
            continue
        if visited[k]:
            continue
        dfs(k)
A, B = [], []
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    A.append(a)
    B.append(b)
    graph[a][b] = True
    graph[b][a] = True 

ans = 0
for a, b in zip(A, B):
    graph[a][b] = False
    graph[b][a] = False
    visited = [False for i in range(N)]
    dfs(0)
    bridge = False
    for j in range(N):
        if not visited[j]:
            bridge = True
    if bridge:
        ans += 1
    graph[a][b] = True
    graph[b][a] = True
print(ans)



Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
int main()
{
	int cs[5], i, j, t, r, fl, fl2;
	char c, s[8][11] = {"null", "one pair", "two pair", "three card", "straight", "full house", "four card"};
	while (std::cin >> cs[0] >> c >> cs[1] >> c >> cs[2] >> c >> cs[3] >> c >> cs[4])
	{
		r = 1;
		std::sort(cs, cs+5);
		int n[13] = {0};
		for (i = 0; i < 5; i++)
			n[cs[i]-1]++;
		for (i = fl = t = 0; i < 13; i++)
			if (n[i] == 2)	t++;
		if (t == 1)	r = 2;
		if (t == 2)	r = 3;
		for (i = fl = 0; i < 13 && !fl; i++)
			if (n[i] == 3)		r = 4, fl = 1;
			else if (n[i] == 4)	r = 7, fl = 1;
		for (i = fl = 0; i < 9 && !fl; i++)
		{
			for (j = 0, fl2 = 1; j < 5 && fl2; j++)
				if (n[i+j] != 1)	fl2 = 0;
			if (fl2)	r = 5, fl2 = 1;
		}
		if (!fl)
		{
			for (i = 9, fl = 0; i < 13 && !fl; i++)
				if (n[i] != 1)	fl = 1;
			if (!fl && n[0])	r = 5;
		}
		for (i = fl = fl2 = 0; i < 13; i++)
		{
			if (n[i] == 2)	fl = 1;
			if (n[i] == 3)	fl2 = 1;
		}
		if (fl && fl2)	r = 6;
		std::cout << s[r-1] << std::endl;
	}
}

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

int main() {
  int n;
  int min=200001;
  int c=0;

  cin >> n;

  vector<int> p(n,0);

  for(int i=0;i<n;i++)
    cin >> p[i];

  for(int i=0;i<n;i++) {
    if(p[i]<min) {min=p[i];c++;}
  }

  cout << c << endl;

  return 0;
}


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

int main(){
  unsigned long long int N, ans = 0;
  //unsigned long long int test = 1;
  cin >> N;
  
  /*for (int i = N; i > 0; i -= 2){
    test *= i;
  }
  cout << test << endl;*/
  
  if (N % 2 == 1){
    cout << "0" << endl;
  }
  else{
    N /= 2;
    
    while (N >= 5){
      N /= 5;
      ans += N;
    }
  
    cout << ans << endl;
  }
}

Measured memory_bytes: 3628
import java.util.*;

class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
    	int N = sc.nextInt();
    	for (int A = 1; A < 10; A++) {
    		for (int B = 1; B < 10; B++) {
    			if (A * B == N) {
    				System.out.println("Yes\n");
    				return;
    			}
    		}
    	}
    	System.out.println("No\n");
    }
}


Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define pb emplace_back
#define endl '\n'
const int maxn = 1e5+5;
#define int long long
vector<int> edge[maxn];

int cnt[maxn];
queue<int> qu;
int dis[maxn];
int32_t main(){
    IOS;
    int n,m;
    cin>>n>>m;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        edge[a].pb(b);
        cnt[b]++;
    }

    rep1(i,n)
        if(!cnt[i])
            qu.push(i);
    int ans=0;
    while(!qu.empty()){
        for(auto x:edge[qu.front()]){
            dis[x]=max(dis[x],dis[qu.front()]+1);
            cnt[x]--;
            ans=max(ans,dis[x]);
            if(!cnt[x])
                qu.push(x);
        }
        qu.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7296
import java.util.*;
import java.lang.*; 
 
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		long H = scan.nextInt();
		long W = scan.nextInt();
		
		long masu = H*W;
		
		long masuno = masu/2;
		
		if(H==1 || W==1){
			System.out.println(1);
		}
		else{
		if(masu%2==0){
			System.out.println(masuno);
		}
		else{
			System.out.println(masuno+1);
		}
		}
	}
}

Measured memory_bytes: 23764
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
typedef long long ll;

double a, b, c, d, e, f;
vector<double> water, sugar;
double ans[2] = {};
double conmax = 0.0;

int main()
{
	cin >> a >> b >> c >> d >> e >> f;
	int A = 100 * a;
	int B = 100 * b;
	double conlim = e / (100 + e);
	ans[0] = A;
	ans[1] = 0;
	for (int i = 0; i < f; i++) {
		for (int j = 0; j < f; j++) {
			int x = A * i + B * j;
			if (x <= f) {
				water.PB(x);
			}
			int y = c * i + d * j;
			if (y <= f) {
				sugar.PB(y);
			}
		}
	}
	for (int i = 0; i < water.size(); i++) {
		for (int j = 0; j < sugar.size(); j++) {
			double con = sugar.at(j) / (water.at(i) + sugar.at(j));
			if (con <= conlim && water.at(i) + sugar.at(j) <= f) {
				if (con > conmax) {
					conmax = con;
					ans[0] = water.at(i) + sugar.at(j);
					ans[1] = sugar.at(j);
				}
			}
		}
	}
	cout << ans[0] << " " << ans[1] << endl;
	return 0;
}

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

#include <sstream>      // std::ostringstream
template <typename T> std::string tostr(const T& t)
{
    std::ostringstream os; os<<t; return os.str();
}

int main() {
    double N;
    int C1, C2;
    cin >> N;
    C1 = (int)( N / 1.08 );
    C2 = C1 + 1;
    string res;
    if ((int)(C1 * 1.08) == N ) {
        res = tostr(C1);
    } else if ((int)(C2 * 1.08) == N ) {
        res = tostr(C2);
    } else {
        res = ":(";
    }

    cout << res << endl;
    return 0;
}



Measured memory_bytes: 3716
/*
ID:greenty2
LANG:C++
TASK:
*/
#include<bits/stdc++.h>
using namespace std;
int top=0;
int main()
{
	int n;
	cin>>n;
	int zuo=0;
	char c;
	string s;
	for(int i=1;i<=n;i++)
	{
		cin>>c;
		s+=c;
		if(c=='(')
		{
			top++;
		}
		if(c==')')
		{
			if(top==0)
			{
				zuo++;
			}
			else
			{
				top--;
			}
		}
	}
	for(int i=1;i<=zuo;i++)
	{
		cout<<"(";
	}
	cout<<s;
	for(int i=1;i<=top;i++)
	{
		cout<<")"; 
	}
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

/*
  3
1 0 4
  2
  5
*/
int dice[6][6] ={ // [top][front] -> right
  {-1, 2, 4, 1, 3,-1},
  { 3,-1, 0, 5,-1, 2},
  { 1, 5,-1,-1, 0, 4},
  { 4, 0,-1,-1, 5, 1},
  { 2,-1, 5, 0,-1, 3},
  {-1, 3, 1, 4, 2,-1}
};

/*
[k]  1
    ???
3 ???  ??? 2
    ???
    0
*/
const int dx[] = {1,-1,0,0}, dy[]={0,0,1,-1};
function<pair<int,int>(int,int)> df[] = { // return <top,front>
  [&](int t, int f){return mp(5-f, t);},
  [&](int t, int f){return mp(f, 5-t);},
  [&](int t, int f){return mp(5-dice[t][f], f);},
  [&](int t, int f){return mp(dice[t][f], f);}
};

int main(){
  int n;
  while(cin>>n, n){
    vector<int> t(n),f(n);
    rep(i,n) cin>>t[i]>>f[i], t[i]--, f[i]--;

    vector<vector<int>> h(205, vector<int>(205,0));  // height
    vector<vector<int>> g(205, vector<int>(205,-1)); // top

    // [top][front] -> check directions
    auto nxt = [](int t, int f){
      vector<int> nums = {f, 5-f, dice[t][f], 5-dice[t][f]};
      vector<pair<int,int>> pv;
      rep(i,4) if(nums[i]>=3) pv.pb(mp(nums[i],i));
      sort(all(pv));reverse(all(pv));
      vector<int> ret;
      for(auto p: pv) ret.pb(p.se);
      return ret;
    };

    rep(i,n){
      int x = 100, y=100;
      while(true){
        bool changed = false;
        for(auto k : nxt(t[i], f[i])){
          int nx = x + dx[k], ny = y + dy[k];
          if(h[nx][ny] < h[x][y]){
            auto p = df[k](t[i], f[i]);
            t[i] = p.first;
            f[i] = p.second;
            x = nx;
            y = ny;
            changed = true;
            break;
          }
        }
        if(!changed) break;
      }//dbg(x,y);
      h[x][y]++;
      g[x][y] = t[i];
    }

    vector<int> ans(6,0);
    rep(i,205)rep(j,205) if(g[i][j]>=0) ans[g[i][j]]++;
    rep(i,6) cout << ans[i] << " \n"[i==5];
  }

  return 0;
}

Measured memory_bytes: 3304
#include <stdio.h>

#define N 100000

int partition(int, int);

int A[N];

int main(){

  int n,i,x;

  scanf("%d",&n);

  for(i=0 ; i<n ; i++){
    scanf("%d",&A[i]);
  }

  x=partition(0,n-1);

  for(i=0 ; i<n ; i++){
    if(i==x) printf("[%d]",A[i]);
    else printf("%d",A[i]);
    if(i<n-1) printf(" ");
  }

  printf("\n");

  return 0;
}

int partition(int p, int r){

  int x,i,j,temp;

  x=A[r];
  i=p-1;

  for(j=p ; j<r ; j++){
  if(A[j]<=x){
    i++;
    temp=A[i];
    A[i]=A[j];
    A[j]=temp;
  }
}
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;

return i+1;

}

Measured memory_bytes: 992
#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int a, b, i, j;
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0) { break; }
		else {
			for (i = 1;i <= b;i++) { printf("#"); }
			printf("\n");
			for (j = 2;j <= a-1;j++) {
				printf("#");
				{ for (i = 2;i <= b-1;i++) { printf("."); }
				printf("#\n");
				}
			}
			for (i = 1;i <= b;i++) { printf("#"); }
			printf("\n");
			printf("\n");
		}
	}
		return 0;
	
}


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

#define mod 1000000007

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

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int N, D, X, A[110], ans = 0;
	
	cin >> N >> D >> X;
	
	rep(i, N){
		cin >> A[i];
		for(int j = 1; j <= D; j += A[i])
			ans++;
	}
	
	cout << ans + X;
	
	return 0;
}

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

int a[105];

int main() {
  int N, M, ans = 0;
  double m, sum = 0;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  m = sum / N;
  M = round(m);
  for (int i = 0; i < N; i++) {
    ans += pow( abs(a[i] - M), 2) ;
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 128
#include<stdio.h>

int main(void) {
	int N;
	int answer = 0;
	scanf("%d", &N);

	for (int i = 1; i <= N; i++) {
		int count = 0;
		if (i % 2 == 0) continue;
		for (int j = 1; j <= i; j++) {
			if (i % j == 0) {
				count++;
			}
		}
		if (count == 8) {
			answer++;
		}
	}
	printf("%d", answer);
	return 0;
}


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

using namespace std;

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

    vector<long long> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    sort(a.begin(), a.end());

    long long res = 0;
    for (int i = 0; i < n - 1; i++) {
        res += a[n - (i + 1) / 2 - 1];
    }

    cout << res << endl;
}


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

int main() {
	int d, c[26], s[365][26];
	cin >> d;
	rep(i, 26) {
		cin >> c[i];
	}
	rep(i, d) {
		rep(j, 26) {
			cin >> s[i][j];
		}
	}
	rep(i, d) {
		cout << i % 26 + 1 << endl;
	}
	return 0;
}

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

using namespace std;

void solve(){
    string s;
    cin>>s;
    int sz = s.size();
    if(sz%2){
        cout<<"No\n";
        return;
    }
    for(int i = 0; i < sz; i++){
        if(s[i%2]!="hi"[i%2]){
            cout<<"No\n";
            return;
        }
    }
    cout<<"Yes\n";
}

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

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n, m;
    cin >> n >> m;
    cout << (n == m ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
N,M = list(map(int, input().strip().split(' ')))
X = list(map(int, input().strip().split(' ')))
if M <= N:
  print(0)
  exit()
X = sorted(X, reverse=True)
diff = [X[i]-X[i+1] for i in range(len(X)-1)]
diff = sorted(diff, reverse=True)
print(sum(diff[N-1:]))

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

using namespace std;

typedef long long ll;
typedef long double real;
typedef pair<int, int> duo;

#define TT template<typename T>
TT T    sq(T x){ return x*x; }
TT int  ubnd(vector<T>& v,T x){ return upper_bound(v.begin(), v.end(), x) - v.begin(); }
TT int  lbnd(vector<T>& v,T x){ return lower_bound(v.begin(), v.end(), x) - v.begin(); }
TT void sort(T& v){ sort(v.begin(), v.end()); }
TT void revs(T& v){ reverse(v.begin(), v.end()); }
TT void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end()), v.end()); }
TT void show(T& v,char d=' ',char e='\n'){for(int i=0;i<v.size();++i)cout<<v[i]<<((i==v.size()-1)?e:d);}
TT void inpt(vector<T>& v,int n){ v.reserve(n);for(int i=0;i<n;++i){T x; cin>>x; v.push_back(x);} }
TT T In(){ T x; cin >> x; return x; }

static inline void fast_io(){ ios::sync_with_stdio(0); cin.tie(0); }
static inline int in(){ int x; scanf("%d", &x); return x; }
static inline string instr(){ string x; cin >> x; return x; }
static inline ll pow_mod(ll a, ll k, ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
static inline ll mod_inv(ll a, ll p){ return pow_mod(a,p-2,p); }
static const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
static const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
static const int Mod = 1000000000;

int main()
{
  int n, m;
  n = in();
  m = in();
  vector<int> sports;
  inpt(sports, n);
  int bucket[1024] = {};
  for (int i = 0; i < m; i++){
    int v = in();
    for (int j = 0; j < n; j++){
      if (sports[j] <= v){
        bucket[j + 1]++;
        break;
      }
    }
  }
  cout << max_element(bucket, bucket + 1024) - bucket << endl;
  return (0);
}

// priority_queue queue deque first second front top push pop map set stringstream max_element min_element insert count find

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

const int INF = 1e9;
const int MAXC = 80;

int main(){
	int h,w;
	cin >> h >> w;
	vector<vector<int>> a(h,vector<int>(w));
	vector<vector<int>> b(h,vector<int>(w));
	
	rep(i,h){
		rep(j,w) cin >> a[i][j];
	}
	rep(i,h){
		rep(j,w) cin >> b[i][j];
	}
	
	vector<vector<int>> c(h,vector<int>(w));
	rep(i,h) rep(j,w) c[i][j] = abs(a[i][j] - b[i][j]);
	
	int MAX = MAXC*(h+w-2);
	bool dp[h][w][MAX];
	rep(i,h) rep(j,w) rep(k,MAX) dp[i][j][k] = false;
	dp[0][0][c[0][0]] = true;
	
	
	rep(i,h){
		rep(j,w){
			rep(k,MAX){
				int n = c[i][j];
				if(i-1 >= 0 && abs(k-n) < MAX) dp[i][j][abs(k-n)] |= dp[i-1][j][k];
				if(j-1 >= 0 && abs(k-n) < MAX) dp[i][j][abs(k-n)] |= dp[i][j-1][k];
				if(i-1 >= 0 && k+n < MAX) dp[i][j][k+n] |= dp[i-1][j][k];
				if(j-1 >= 0 && k+n < MAX) dp[i][j][k+n] |= dp[i][j-1][k];
			}
		}
	}
	
	rep(k,MAX){
		if(dp[h-1][w-1][k]){
			cout << k << endl;
			return 0;
		}
	}

}


Measured memory_bytes: 79360
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

void solve(){
    int n;
    cin >> n;
    int x[n+1],y[n+1]; 
    int a[n+1];

    for(int i = 1;i<=n;i++)cin >> x[i];
    for(int i = 1;i<=n;i++)cin >> y[i];

    for(int i = 1;i<=n;i++){
        a[i] = i;
    }

    int cnt1 = 0, cnt2 =0 , cnt = 1;

    do{
        bool flag = false;
        if(cnt1 ==0 || cnt2==0)flag = true;
        for(int i = 1;i<=n;i++){
            if(a[i]!=x[i])flag = false;
        }

        if(flag)cnt1 = cnt;
        flag = true;

        for(int i = 1;i<=n;i++){
            if(a[i]!=y[i])flag = false;
        }

        if(flag)cnt2 = cnt;
        cnt++;

    }while(next_permutation(a+1,a+n+1));

    cout << abs(cnt2-cnt1) << endl;
    

} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            var NC = Sarray();
            var N = NC[0];
            var C = NC[1];
            var H = Sarray();
            var cft = new ConvexFullTric();
            var dp = new int[N].Select(_ => long.MaxValue).ToArray();
            dp[0] = 0;
            for (var i = 1; i < N; ++i)
            {
                cft.add(-2 * H[i - 1], dp[i - 1] + H[i - 1] * H[i - 1]);
                dp[i] = cft.get(H[i]) + H[i] * H[i] + C;
            }
            WriteLine(dp[N - 1]);
        }
        //http://satanic0258.hatenablog.com/entry/2016/08/16/181331
        public class ConvexFullTric
        {
            class pair<T,U>:IComparable<pair<T,U>>where      T:IComparable<T> where U:IComparable<U>
            {
                public T v1;
                public U v2;
                public pair(T v1, U v2)
                {
                    this.v1 = v1;
                    this.v2 = v2;
                }
                public int CompareTo(pair<T, U> a) => v1.CompareTo(a.v1) != 0 ? v1.CompareTo(a.v1) : v2.CompareTo(a.v2);
            }
            //直線群
            List<pair<long, long>> lines;
            public ConvexFullTric()
            {
                lines = new List<pair<long, long>>();
            }
            void swap(pair<long, long> l, pair<long, long> r)
            {
                var t = l; l = r; r = t;
            }
            bool check(pair<long, long> l1, pair<long, long> l2, pair<long, long> l3)
            {
                if (l1.CompareTo(l3) < 0) swap(l1, l3);
                return (l3.v2 - l2.v2) * (l2.v1 - l1.v1) >= (l2.v2 - l1.v2) * (l3.v1 - l2.v1);
            }
            public void add(long a, long b)
            {
                var line = new pair<long, long>(a, b);
                while (2 <= lines.Count && check(lines[lines.Count - 2], lines[lines.Count - 1], line))
                    lines.RemoveAt(lines.Count - 1);
                lines.Add(line);
            }
            long f(int i, long x) => lines[i].v1 * x + lines[i].v2;
            long f(pair<long, long> line, long x) => line.v1 * x + line.v2;
            int head = 0;
            public long get(long x)
            {
                while (2 <= lines.Count - head && f(head + 1, x) < f(head, x))
                    ++head;
                return f(head, x);
            }
        }
    }
}

Measured memory_bytes: 49152
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color, D; vll path;
//***********//
int main() {
	cin >> N;
	vl P(N);
	for (i = 0; i < N; i++) {
		cin >> P[i];
	}
	sort(P.begin(), P.end());
	reverse(P.begin(), P.end());
	ans += P[0] / 2;
	for (i = 1; i < N; i++) {
		ans += P[i];
	}
	cout << ans;
}

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


X = abs(X)
a = K*D
if X >= a:
    result = X-a
else:
    b = X//D
    c = (X-b*D)
    d = abs(X-(b+1)*D)
    if c < d:
        if b%2==K%2:
            result = c
        else:
            result = d
    else:
        if (b+1)%2==K%2:
            result=d
        else:
            result=c

print(result)

Measured memory_bytes: 9188
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

inline char get(void) {
  static char buf[100000], *S = buf, *T = buf;
  if (S == T) {
    T = (S = buf) + fread(buf, 1, 100000, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
inline void read(int &x) {
  static char c; x = 0; int sgn = 0;
  for (c = get(); c < '0' || c > '9'; c = get()) if (c == '-') sgn = 1;
  for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
  if (sgn) x = -x;
}

int a, b, c;

int main(void) {
  read(a); read(b); read(c);
  for (int i = 1; i <= b; i++)
    if (a * i % b == c) {
      puts("YES"); return 0;
    }
  puts("NO");
  return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace ARC089D
{
    public class Program
    {
        int N;
        int K;
        int K2;
        int[,] imos;

        void Add(int lx, int ty, int rx, int by)
        {
            lx %= K2;
            ty %= K2;
            rx %= K2;
            by %= K2;

            if (lx > rx)
            {
                Add(lx, ty, K2 - 1, by);
                Add(0, ty, rx, by);
                return;
            }
            if (ty > by)
            {
                Add(lx, ty, rx, K2 - 1);
                Add(lx, 0, rx, by);
                return;
            }

            imos[ty, lx]++;
            imos[by + 1, lx]--;
            imos[ty, rx + 1]--;
            imos[by + 1, rx + 1]++;
        }

        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            N = ss.Next(int.Parse);
            K = ss.Next(int.Parse);
            K2 = K * 2;
            imos = new int[K2 + 1, K2 + 1];

            for (var i = 0; i < N; i++)
            {
                var X = ss.Next(int.Parse);
                var Y = ss.Next(int.Parse);
                var C = ss.Next(String);
                if (C == "B") X += K;

                Add(X, Y, X + K - 1, Y + K - 1);
                Add(X + K, Y + K, X + K2 - 1, Y + K2 - 1);
            }

            var max = 0;
            for (var i = 0; i < 2 * K; i++)
            for (var j = 0; j < 2 * K; j++)
            {
                if (i != 0) imos[i, j] += imos[i - 1, j];
                if (j != 0) imos[i, j] += imos[i, j - 1];
                if (i != 0 && j != 0) imos[i, j] -= imos[i - 1, j - 1];
                max = Math.Max(max, imos[i, j]);
            }
            sw.WriteLine(max);
            //---------------------------------
        }

        static void Main()
        {
            var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput()));
            var sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            new Program().Solve(ss, sw);
            sw.Flush();
        }

        static readonly Func<string, string> String = s => s;
    }

    public class StreamScanner
    {
        static readonly char[] Sep = {' '};
        readonly Queue<string> buffer = new Queue<string>();
        readonly TextReader textReader;

        public StreamScanner(TextReader textReader)
        {
            this.textReader = textReader;
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (buffer.Count != 0) return parser(buffer.Dequeue());
            var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries);
            foreach (var nextString in nextStrings) buffer.Enqueue(nextString);
            return Next(parser);
        }
    }
}

Measured memory_bytes: 30816
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;



int solve(int h[],int n)
{
    if(n==2 ||  n==3)
    return abs(h[n-1]-h[0]);
    else
    return min(abs(h[n-1]-h[n-2])+solve(h,n-1),abs(h[n-1]-h[n-3])+solve(h,n-2));
}

int main()
{
    int n;
    
    cin>>n;
    int h[n], dp[n+1];
    for(int i=0;i<n;i++)
    cin>>h[i];
    //cout<<solve(h,n);
    dp[2]=abs(h[1]-h[0]);dp[3]=abs(h[2]-h[0]);
    for(int i=4;i<=n;i++)
    dp[i]=min(abs(h[i-1]-h[i-2])+dp[i-1],abs(h[i-1]-h[i-3])+dp[i-2]);
    cout<<dp[n];
    
}















Measured memory_bytes: 4308
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;


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

	string s;
	cin >> s;
	s.resize(s.size() - 8);
	cout << s << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
bool saiki(string a,int& i){
  bool hantei=true;
  //cout<<a[i]<<endl;
  int j;
  for(j=i+1;j<a.size();j++){
    if((a[i]=='['&&a[j]==')')||(a[i]=='('&&a[j]==']'))return false;
    if(a[i]=='('&&a[j]==')'){
      i=j;
      return true;
    }
    if(a[i]=='['&&a[j]==']'){
      i=j;
      return true;
    }
    if(a[j]=='('||a[j]=='['){
      hantei=saiki(a,j);
      if(hantei==false)return false;
    }
  }
  return false;
}
int main(){
  string a;
  while(getline(cin,a),a.size()!=1&&a[0]!='.'){
    bool hantei = true;
    for(int i=0;i<a.size();i++){
      if(a[i]==')'||a[i]==']'){hantei=false;break;}
      if(a[i]=='('||a[i]=='['){
	hantei=saiki(a,i);
      }
      if(hantei==false){
	break;
      }
    }
    if(hantei==false)
      cout<<"no"<<endl;
    else
      cout<<"yes"<<endl;
  }
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define LINF 6000000000000000007LL
#define ll long long
using namespace std;
int N;
ll data[530000],datb[530000]; // 0-indexed
void init(int n_){
	N = 1;
	while(N<=n_)N*=2;
}
void add(int a,int b, int x,int k,int l,int r){ // add x to [a,b) k=0, l=0, r=N
	if(a <= l && r<=b){
		data[k] += x;
	}
	else if( l<b && a<r ){
		datb[k] += (min(b,r)-max(a,l)) * x;
		add( a,b,x,k*2+1,l,(l+r)/2);
		add( a,b,x,k*2+2,(l+r)/2,r);
	}
}
ll sum(int a,int b,int k,int l,int r){ // sum of [l,r)
	if(b<=l || r<=a){
		return 0;
	}
	else if(a<= l && r<=b){
		return data[k]*(r-l)+datb[k];
	}
	else{
		ll res = (min(b,r) -max(a,l)) * data[k];
		res += sum(a,b,k*2+1,l,(l+r)/2);
		res += sum(a,b,k*2+2,(l+r)/2,r);
		return res;
	}
}
signed main(){
	int n,c;
	cin>>n>>c;
	init(214514);
	vector< pair<int,int>  > P[35];
	for(int i=0;i<n;i++){
		int s,t,cc;
		cin>>s>>t>>cc; //c???
		P[cc].pb( mp(s,t) );
	}
	for(int i=1;i<=c;i++){
		sort( P[i].begin(), P[i].end() );
		stack< pair<int,int> > s;
		for(int j=0;j<P[i].size();j++){	
			pair<int,int> cur = P[i][j];
			if( !s.empty() && s.top().second == cur.first){
				pair<int,int> st = s.top(); s.pop();
				s.push( mp( st.first, cur.second ) );
			}
			else{
				s.push(cur);
			}
		}
		while(!s.empty()){
			pair<int,int> PA = s.top(); s.pop();
			add( 2*PA.first-1, 2*PA.second, 1, 0, 0, N);
		}
	}		
	int ans = 0;
	for(int i=0;i<=200000;i++){
		int tmp = sum(i,i+1,0,0,N);
		if(ans<tmp)ans=tmp;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &e : a)
    cin >> e;
  int t = round(1.0 * accumulate(begin(a), end(a), 0) / n);
  int sum = 0;
  for (auto &e : a)
  {
    sum += (e - t) * (e - t);
  }
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
s= input()

s_r = s[::-1]
N = len(s)
s_2 = s[:int((N-1)/2)]
s_3 = s[int((N+1)/2):]
#print(s_r, s_2, s_3)
if ( (s == s_r) & (s_2 ==s_2[::-1]) &(s_3 ==s_3[::-1])):
  print('Yes')
else :
  print('No')
  

Measured memory_bytes: 2940
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul unsigned long long
#define ll long long
#define rup(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rdn(i, a, b) for(int (i) = (a); (i) > (b); (i)--)

int main() {
	int n, a;
	cin >> n;
	cin >> a;
	cout << n*n - a;

	return 0;
}





Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
#include <regex>
#include <numeric>
#include <functional>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }




int main(int argc, char* argv[])
{
	for (;;) {
		int N, X, L;

		cin >> N >> X;
		if (cin.fail()) break;

		int res = 1;
		int pos = 0;
		while (N--) {
			cin >> L;
			pos += L;
			if (pos <= X) {
				res++;
			}
		}

		cout << res << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>

int main()
{
    // std::cout << std::fixed << std::setprecision(5);
    int n, m;
    std::cin >> n >> m;
    std::string a[n], b[m];
    for(int i=0; i<n; i++) std::cin >> a[i];
    for(int i=0; i<m; i++) std::cin >> b[i];
    
    bool exist = false;

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            if(i+m-1>n || j+m-1>n) continue;

            bool match = true;
            for(int p = 0; p < m; p++)
            {
                for (int q = 0; q < m; q++)
                {
                    if(a[i+p][j+q]!=b[p][q]) match = false;
                }
            }
            if(match) exist = true;
        }
    }

    if(exist)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}  // 1次元 vector
template <class T>
ostream &operator<<(ostream &s, vector<T> vec) {
    for (int i = 0; i < (int)vec.size(); ++i) {
        if (i > 0) {
            s << " ";
        }
        s << vec[i];
    }
    return s << endl;
}
template <class T>  // 2次元 vector
ostream &operator<<(ostream &s, vector<vector<T>> vec2) {
    for (int i = 0; i < (int)vec2.size(); ++i) {
        s << vec2[i];
    }
    return s;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i, x, n) for (int i = x; i < n; i++)
#define fb(i, x, n) for (int i = n - 1; i >= 0; i--)
#define w(t)  \
    int t;    \
    cin >> t; \
    while (t--)
typedef unsigned long long ull;
typedef vector<long long> vi;
#define ull unsigned long long
#define msi map<string, long long>
#define mii map<long long, long long>
const int MX = 2e5 + 5;
const int INF = 1e18;
#define pb push_back
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    // online submission
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
     long long a,b,c,p,q;
    cin>>a>>b>>c;
    a=abs(a);
    if (abs(a/c)>b)cout<<abs(a-(b*c));
    else 
    {
        if (a<0)a=-a;
        p=(a%c);
        q=abs(p-c);
        if (p<q)
        {
            if ((b-(a/c))%2==0)cout<<p;
            else cout<<q;
        }
        else
        {
            if ((b-(a/c))%2==0)cout<<p;
            else cout<<q;
        }
    }
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 3704
n,k=gets.split.map &:to_i
a=[]
b=0
b=n/11 if n>=22
n=11+n%11 if n>=22
if n>=3
0.upto(n-3) do |j|
  0.upto(4) do |i|
    a<< [i+1,j+1] if (4+i*9+j*8)%11==k
  end
end
end
if a==[]
  p 0
else
  p a.length+b*5-(b!=0 ? 5:0)
end

Measured memory_bytes: 1788
using System;

namespace てすと
{
    class Program
    {

        //168-A

        static void Main(string[] args)
        {
            var inputNum = int.Parse(Console.ReadLine());
            if (inputNum % 10 == 3)
            {
                Console.WriteLine("bon");
            }
            else if (inputNum % 10 == 0 || inputNum % 10 == 1 || inputNum % 10 == 6 || inputNum % 10 == 8)
            {
                Console.WriteLine("pon");
            }
            else
            {
                Console.WriteLine("hon");
            }
        }


    }
}

Measured memory_bytes: 27492
import bisect

n = int(input())
l = list(map(int,input().split()))
l.sort()

ans = 0
for i in range(n-2) :
  for j in range(i+1,n-1) :
    index = bisect.bisect_left(l,l[i]+l[j])
    ans += index-1-j

print(ans)

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

int dat[300005];

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n * 3; i++)
	{
		scanf("%d", &dat[i]);
	}
	sort(dat, dat + n * 3);
	long long sum = 0;
	for (int i = n * 3 - 2; i > n * 3 - 2 - 2 * n; i -= 2) sum += dat[i];
	printf("%lld\n", sum);
}

Measured memory_bytes: 1408
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author emli
 */


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

typedef long long ll;
class BMultipleOf9 {
public:
    void solve(std::istream& cin, std::ostream& cout) {
		ios::sync_with_stdio(false);
        cin.tie(nullptr);
        string s;
        cin >> s;

        int sum = 0;
        for(char x : s){
            sum += (x - '0');
        }
        if (sum % 9 == 0){
            cout << "Yes" << endl;
        }else {
            cout << "No" << endl;
        }
	}
};


int main() {
	BMultipleOf9 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N; cin >> N;
    int A[202020], B[202020];
    for(int i=0;i<N;++i) cin >> A[i];
    for(int i=0;i<N;++i) cin >> B[i];

    int ans = 0;
    for(int i = 29; i >= 0; --i) {
        // check whether i th bit is 1
        int low  = (1<<i);
        int high = (1<<i+1);
        for(int j=0; j < N; ++j) A[j] %= high, B[j] %= high;
        sort(B, B + N);

        int cnt = 0;
        // 2^i <= A[a] + B[x] < 2^(i+1)
        // これを満たすB[x]の数を数える。
        // ソートした後に二分探索*2で上端　－　下端すればOK？
        for(int a = 0; a < N; ++a) {
            if(low - A[a] >= 0) cnt += lower_bound(B, B+N, high - A[a]) - lower_bound(B, B+N, low - A[a]);
            else {
                cnt += lower_bound(B, B+N, high - A[a]) - lower_bound(B, B+N, 0);
                cnt += lower_bound(B, B+N, high) - lower_bound(B, B+N, high + low - A[a]);
            }
        }
        if(cnt&1) ans |= (1<<i);
    }

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

Measured memory_bytes: 1920
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int n, x, mini=1001;
	cin >> n >> x;
	for(int i=0; i<n; i++){
		int m;
		cin >> m;
		x -= m;
		mini = min(mini, m);
	}
	cout << n+x/mini << '\n';
	return 0;
}

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

using namespace std;

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

    int n;
    cin  >> n;
    int gcd = 0;
    for(int i = 0 ; i < n ; ++i)
    {
        int h;
        cin >> h;
        gcd = __gcd(gcd, h);
    }

    cout << gcd << endl;

    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
// utility
#include <bitset>
#include <tuple>
#include <typeinfo>
// error handling
#include <cassert>
// string
#include <cctype>
#include <cstring>
#include <string>
// container
#include <array>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// algorithm
#include <algorithm>
// iterator
#include <iterator>
// math
#include <cmath>
#include <complex>
#include <numeric>
#include <random>
// i/o
#include <cstdio>
#include <iomanip>
#include <iostream>

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]) == typeid(INF) and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int R; cin >> R;

  if(R<1200){
    cout<<"ABC"<<endl;
  }
  else if(R<2800){
    cout<<"ARC"<<endl;
  }
  else {
    cout<<"AGC"<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] ag) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		int D=sc.nextInt();

		int res=Math.max(Math.min(B, D)-Math.max(A, C), 0);
		System.out.println(res);
	}
}

Measured memory_bytes: 23764
a,b,c,d=map(int,input().split())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)
a1=(a-1)//c
a2=b//c
b1=(a-1)//d
b2=b//d
new_lcm=lcm(c,d)
c1=(a-1)//new_lcm
c2=b//new_lcm
print((b-a)+1-((a2-a1)+(b2-b1))+(c2-c1))
#print(a1,a2,b1,b2,c1,c2)


Measured memory_bytes: 3064