akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
 ///解説AC
  int main(){      
      double n,m,d;
      cin>>n>>m>>d;
      if(d==0){
          printf("%.9f",1/n*(m-1));
      }else{
          printf("%.9f",2*(n-d)/n/n*(m-1));
      }
      }
      
    

  
          
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    string a,b;
    cin >> a >> b;
    int n=min(a.size(),b.size());
    if(a.size()<b.size())cout << "LESS";
    else if(a.size()>b.size())cout << "GREATER";
    else{
        for(int i=0; i<n; i++){
            if(a[i]<b[i]){
                cout << "LESS";
                break;
            }
            else if(a[i]>b[i]){
                cout << "GREATER";
                break;
            }
            else{
                cout << "EQUAL";  
                break;
            } 
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

ll hantei_sosu(ll inp_num) {
  bool flag = false;

  rep(i,inp_num) {
    if(i == 0) continue;
    if(i == 1) continue;
    if(inp_num%i == 0) {
      flag = true;
      break;
    }
  }

  if(flag) return 0;
  else return 1;
}


int main() {
  ll n; cin >> n;
  if(n == 1) {
    cout << 1 << endl;
    return 0;
  }

  vector<ll> soinsu(1001,0);
  vector<ll> sosu;

  for(ll i = 2; i  < n + 1;i++) {
    ll tmp = i;
    if(hantei_sosu(i) == 1) sosu.push_back(i);

    for(ll t = 0; t < sosu.size(); t++) {
      if(tmp%sosu.at(t) == 0) {
        tmp /= sosu.at(t);
        soinsu.at(sosu.at(t))++;
        t--;
      }
    }
  }

  ll ans=1;
  rep(i,1001) {
    if(soinsu.at(i) != 0) {
      //cout << i << endl;
      ans *= (soinsu.at(i) + 1);
      ans %= ATCODER_AMARI;
    }
  }

  cout << ans << endl;
  
}



Measured memory_bytes: 3640
#include<stdio.h>

int A[2000000],B[2000000];
int main(){

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

  for(i=0;i<=10000;i++){
    C[i] = 0;
}
  for(j=0;j<n;j++){
    C[A[j+1]]++;

  }
  for(i=1;i<10000;i++){
    C[i] = C[i]+C[i-1];

  }

  for(j=1;j<=n;j++){

    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i=1;i<n;i++){

    printf("%d ",B[i]);

  }
  printf("%d\n",B[i]);

  return 0;
}

Measured memory_bytes: 16264
def poker(a, b)
  if a == b
    puts "Draw"
  elsif a == 1
    puts "Alice"
  elsif b == 1
    puts "Bob"
  elsif a > b
    puts "Alice"
  else
    puts "Bob"
  end
end

a, b = gets.chomp.split(" ").map(&:to_i)
poker(a, b)

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

#define endl '\n'
#define int long long

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int dp[2500], s, mod = 1e9 + 7;
	cin >> s;
	memset(dp, -1, sizeof dp);
	function<int(int)> solve = [&] (int sum) {
		if(sum > s) return 0LL;
		if(sum == s) return 1LL;
		int &ans = dp[sum];
		if(ans != -1) return ans;
		ans = 0;
		for(int i = 3; i + sum <= s; i ++) {
			ans += solve(i + sum);
			ans %= mod;
		}
		return ans;
	};
	cout << solve(0) << endl;

	return 0;
}

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

int main(void)
{
    string A, B, C;
    cin >> A >> B >> C;
    if(A[A.size()-1]==B[0] and B[B.size()-1]==C[0])
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long n;
  std::vector<std::string> xs;
  std::vector<std::string> ys;
  Solver() {
    S002 r;
    r >= n;
  }  
  void solve() {
    long res = n * 800 - (n / 15) * 200;
    printf("%ld\n", res);
  }
};
 
int main() {
  for(;;) std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#define all(x) x.begin(), x.end()
#define chmin(x,y) x=min(x,y)
#define rep(I,N) for(int I=0; I<N; I++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1001001001;

int main(){
  int n, k; auto dmy = scanf("%d %d", &n, &k);
  int max_k = (n-1)*(n-2)/2;
  if(max_k < k){printf("-1\n"); return 0;}
  
  vector<pii> gragh;
  for(int i=2; i<n+1; i++){
    gragh.emplace_back(1,i);
  }
  int count=max_k-k;
  for(int i=2; i<n+1; i++){
    for(int j=i+1; j<n+1; j++){
      if(count==0) break;
      gragh.emplace_back(i,j);count--;
    }
    if(count==0) break;
  }
  
  int m = (int)gragh.size();
  printf("%d\n", m);
  rep(i,m) printf("%d %d\n", gragh[i].first, gragh[i].second);
  
  
  /*
  vector< vector<int> > dist(n, vector<int>(n,INF));
  rep(i,n) dist[i][i] = 0;
  rep(i,m){
    int a = gragh[i].first-1;
    int b = gragh[i].second-1;
	dist[a][b] = dist[b][a] = 1;
  }
  rep(l,n) rep(i,n) rep(j,n) chmin(dist[i][j], dist[i][l]+dist[l][j]);
  rep(i,n-1) for(int j=i+1; j<n; j++) if(dist[i][j] == 2) count++;
  printf("count = %d\n", count);
  */
}

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

using namespace std;

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

int main(){
   
   int n,m,b,c;
   cin >> n >> m;
   int a[n] = {0};
   rep(i,m){
      cin >> b >> c;
      a[b - 1]++;
      a[c - 1]++;
   }
   rep(i,n){
      cout << a[i] << endl;
   }

   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define umii            unordered_map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define rep(i,st,end)   for(int i=st;i<end;i++)
#define w(x)            int x; cin>>x; while(x--)
//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

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

void s_g_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	s_g_c();
	string s, t;
	cin >> s >> t;
	int count = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] != t[i])
			count++;
	}
	cout << count << endl;
	return 0;
}

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

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

    vector<int> A(N);
    string nm = "";
    for (int i=0; i<M ; i++){
        nm += "0";
    }
    for (int i=0; i<N ; i++){
        nm += "1";
    }

    int ans = 0;
    do {
        int count=0;
        int j=0;
        if(nm[0] == '1') continue;
        for(int i = 0; i< N+M; i++){
            if(nm[i] == '0') count++;
            if(nm[i] == '1'){
                A[j] = count;
                j++;
            }
        }

        int score = 0;
        for(int q = 0; q < Q; q++){
            if(A[b[q]] - A[a[q]] == c[q]){
                score += d[q];
            }
        }
        ans = max(score, ans);

    } while (std::next_permutation(nm.begin(), nm.end()));

    cout << ans << endl;
}

Measured memory_bytes: 3644
def calc():
	n = int(input())
	c = 0

	for _ in range(n) :
		d1, d2 = ( int(j) for j in input().split() )
		if d1 == d2 : c = c + 1
		else : c = 0
		if c == 3 : break

	if c == 3 : print("Yes")
	else : print("No")

def main() :
	calc()

if __name__ == '__main__' :
	main()

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

int main(){
    int K,A,B;
    cin>>K>>A>>B;
    int var =A;
if(A>=1&&B>=A&&B<=1000&&K>=1&&K<=1000){
   while(var<=B){
       if(var%K==0){
           cout<<"OK";
           break;
       }
    
        if(var==B&&B%K!=0){
            cout<<"NG";
        }
    var++;
   }
}
    return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int A, B, C, D, E, F, water, sugar;
double result;

int main()
{
    scanf("%d %d %d %d %d %d", &A, &B, &C, &D, &E, &F);
    for(int k = 0; A * k * 100 < F; k++)
    {
        for(int l = 0; A * k * 100 + B * l * 100 < F; l++)
        {
            int minWater;
            minWater = min(F - A * k * 100 - B * l * 100, (A * k + B * l) * E);
            for(int i = 0; i * C <= minWater; i++)
            {
                for(int j = 0; i * C + j * D <= minWater; j++)
                {
                    if(i == 0 && j == 0)
                    {
                        continue;
                    }
                    int tempWater, tempSugar;
                    tempWater = (A * k + B * l) * 100;
                    tempSugar = i * C + j * D;
                    if(result < (double)tempSugar * 100 / (tempWater + tempSugar))
                    {
                        result = (double)tempSugar * 100 / (tempWater + tempSugar);
                        water = tempWater;
                        sugar = tempSugar;
                    }
                }
            }
        }
    }
    if(result == 0)
    {
        water = A * 100;
    }
    printf("%d %d", water + sugar, sugar);
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		long K = sc.nextLong();
		sc.close();
		
		for(int i=0;i<Math.min(S.length(),K);i++) {
			if(S.charAt(i) != '1') {
				out.println(S.charAt(i));
				return;
			}
		}
		out.println("1");

	}

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

}


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

using namespace std;

const int IINF = INT_MAX;
int V,E,r;

vector<int> G[110000];
vector<int> W[110000];
int mindist[110000];

void dijkstra(){
  for(int i=0;i<V;i++) mindist[i] = IINF;
  mindist[r] = 0;
  priority_queue<int> Q;
  Q.push(r);
  while( !Q.empty() ){
    int cur = Q.top(); Q.pop();
    for(int i=0;i<(int)G[cur].size();i++){
      int next   = G[cur][i];
      int weight = W[cur][i];
      if( mindist[next] > mindist[cur] + weight )  {
	mindist[next] = mindist[cur] + weight;
	Q.push(next);
      }
    }
  }
}

int main(){

  cin >> V >> E >> r;

  for(int i=0;i<E;i++) {
    int s,t,d;
    cin >> s >> t >> d;
    G[s].push_back(t);
    W[s].push_back(d);
  }

  dijkstra();
  
  for(int t=0;t<V;t++) {
    if( mindist[t] != IINF ) cout << mindist[t] << endl;
    else                     cout << "INF" << endl;
  }

  return 0;
}

Measured memory_bytes: 19136
using System;
using System.Linq;

namespace C
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			var c1n = Console.ReadLine().Split().Select(int.Parse).ToArray();
			var c2n = Console.ReadLine().Split().Select(int.Parse).ToArray();
			var c3n = Console.ReadLine().Split().Select(int.Parse).ToArray();

			Console.WriteLine(check(c1n, c2n) && check(c1n, c3n) ? "Yes" : "No");
		}

		private static bool check(int[] row1, int[] row2)
		{
			return row1[0] - row2[0] == row1[1] - row2[1] && row1[2] - row2[2] == row1[1] - row2[1];
		}
	}
}

Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <math.h>
#include <iomanip>

typedef long long ll;
using namespace std;
int main(){
    string s;
    cin >> s;
    int ctr=0;
    for(auto ss : s){
        ctr += (ss=='o');
    }
    ctr += (15 - s.size());
    string ret[] = {"NO", "YES"};
    cout << ret[(ctr>=8)] << endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define VI vector<int> 
#define SI set<int>
#define QI queue<int> 
#define MII map<int,int>
#define PB push_back
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define M 1000000007
using namespace std;

int main()
{
    FIO
    int n; cin>>n;
    string str,ans=""; cin>>str;
    int l = str.size();

    for (int i = 0; i < l; ++i)
    {
        if (str[i]+n <= 90)
        {
            ans += str[i]+n;
        }
        else
        ans += (((str[i]+n)%91)+65);
    }

    cout<<ans;



    
    return 0;
}

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

typedef long long LL;
const int N = 56;
const int K = 5;
const LL mod = 1e9 + 7;

LL dp[N][K][K];

int main ()
{
    int n;
    cin >> n;
    string a,b;
    cin >>a >> b;
    a=" "+a;
    b=" "+b;
    for (int i=1;n>=i;i++)
    {
        if (i==1)
        {
            if (a[i] == b[i])
            {
                dp[1][1][1] = dp[1][2][2] = dp[1][3][3] = 1;
            }
            else
            {
                dp[1][1][2] = dp[1][1][3] = dp[1][2][1] = dp[1][2][3] = dp[1][3][1] = dp[1][3][2] = 1;
            }
        }
        else
        {
            if (a[i] == a[i-1])
            {
                assert(b[i] == b[i-1]);
                for (int x=1;3>=x;x++)
                {
                    for (int y=1;3>=y;y++)
                    {
                        dp[i][x][y] = dp[i-1][x][y];
                    }
                }
            }
            else
            {
                if (a[i] == b[i])
                {
                    dp[i][1][1] = dp[i-1][2][3] + dp[i-1][3][2] + dp[i-1][2][2] + dp[i-1][3][3];
                    dp[i][2][2] = dp[i-1][1][3] + dp[i-1][3][1] + dp[i-1][1][1] + dp[i-1][3][3];
                    dp[i][3][3] = dp[i-1][1][2] + dp[i-1][2][1] + dp[i-1][2][2] + dp[i-1][1][1];
                }
                else if (a[i] != b[i])
                {
                    assert(a[i] != a[i-1]);
                    assert(b[i] != b[i-1]);
                    dp[i][1][2] = dp[i-1][3][1] + dp[i-1][2][1] + dp[i-1][2][3] + dp[i-1][3][3];
                    dp[i][1][3] = dp[i-1][2][1] + dp[i-1][3][1] + dp[i-1][3][2] + dp[i-1][2][2];
                    dp[i][2][1] = dp[i-1][1][2] + dp[i-1][1][3] + dp[i-1][3][2] + dp[i-1][3][3];
                    dp[i][2][3] = dp[i-1][1][2] + dp[i-1][3][1] + dp[i-1][3][2] + dp[i-1][1][1];
                    dp[i][3][1] = dp[i-1][1][2] + dp[i-1][1][3] + dp[i-1][2][3] + dp[i-1][2][2];
                    dp[i][3][2] = dp[i-1][1][3] + dp[i-1][2][1] + dp[i-1][2][3] + dp[i-1][1][1];
                }
            }
        }
        for (int x=1;3>=x;x++)
        {
            for (int y=1;3>=y;y++)
            {
                dp[i][x][y] %= mod;
            }
        }
    }
    LL ans=0;
    for (int x=1;3>=x;x++)
    {
        for (int y=1;3>=y;y++)
        {
            ans += dp[n][x][y];
        }
    }
    cout << ans%mod<<endl;
}


Measured memory_bytes: 256
import sys
from heapq import heappush, heappop

def main():
    input = sys.stdin.readline
    X, Y, Z, K = map(int, input().split())
    A = sorted(list(map(int, input().split())), key=lambda x: -x)
    B = sorted(list(map(int, input().split())), key=lambda x: -x)
    C = sorted(list(map(int, input().split())), key=lambda x: -x)

    deli = []
    heappush(deli, (-A[0]-B[0]-C[0], 0, 0, 0))
    pushed = set((0,0,0))
    for _ in range(K):
        d = heappop(deli)
        i, j, k = d[1], d[2], d[3]

        if i+1 < X and (i+1, j, k) not in pushed:
            heappush(deli, (-A[i+1]-B[j]-C[k], i+1, j, k))
            pushed.add((i+1, j, k))

        if j+1 < Y and (i, j+1, k) not in pushed:
            heappush(deli, (-A[i]-B[j+1]-C[k], i, j+1, k))
            pushed.add((i, j+1, k))

        if k+1 < Z and (i, j, k+1) not in pushed:
            heappush(deli, (-A[i]-B[j]-C[k+1], i, j, k+1))
            pushed.add((i, j, k+1))

        print(-d[0])


if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;
#define each(i, mp) for(auto& i:mp)

int main() {
    string s;
    cin >> s;
    map<ll, ll> mp;
    mp[0] = 1;
    reverse(s.begin(), s.end());
    ll now = 0, ten = 1;
    each(e, s) {
        now = (now + (e - '0') * ten) % 2019;
        ten *= 10;
        ten %= 2019;
        mp[now]++;
    }
    ll ans = 0;
    each(e, mp) {
        ans += e.second * (e.second - 1) / 2;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3768
#include <stdio.h>
int main(void){
    int i,j;
    int n;
    scanf("%d\n",&n);
    int h[n];
    for (i=0;i<n;i++){
	scanf("%d",&h[i]);
	}


    int max=0;
    for (i=0;i<n;i=j+1){
	int k=0;
	for (j=i;h[j]>=h[j+1];j++)if(j<n-1)k++;
	if(max<k)max=k;
	}
    printf("%d\n",max);

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  vector<int> p(n);
  for (int i=0;i<n;i++){
    cin >> s[i] >> p[i];
  }
  vector<pair<pair<string, int>, int>> t(n);
  for(int i=0;i<n;i++){
    t[i]=make_pair(make_pair(s[i],p[i]*(-1)),i);
  }
  sort(t.begin(),t.end());
  for(int i=0;i<n;i++){
    cout << t[i].second+1 << endl;
  }
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextLong()
  val k = sc.nextLong()

  var count1 = 0L
  for (i in 1..n) {
    if (i % k == 0L) {
      count1++
    }
  }
  var ans = count1 * count1 * count1

  if (k % 2 == 0L) {
    var count2 = 0L
    for (i in 1..n) {
      if (i % k == k / 2L) {
        count2++
      }
    }
    val tmp = count2 * count2 * count2
    ans += tmp
  }

  println(ans)
}


Measured memory_bytes: 31396
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int ll 
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = -1;
#ifndef LOCAL
#define cerr if(0)cout
#endif
 
int32_t main() 
{
	IAMSPEED
	int n; cin >> n;
	vector<int>v;
	FOR(i,1,n) {
		int x; cin >> x;
		v.pb(x);
	}
	ll ans = 0;
	FOR(i,0,v.size()-1) {
		FOR(j,i+1,v.size()-1) {
			ans += v[i] * v[j];
		}
	}
	cout<<ans;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int l;
  l = s.length();
  bool ok = 1;
  for(int i = 0;i<(l+1)/2;i++){
    if(s[i]!=s[l-i-1]){
      ok = 0;
      break;
    }
  }
  int k;
  k = (l)/2;
  for(int i = 0;i<(k+1)/2;i++){
    if(s[i]!=s[k-i-1]){
      ok = 0;
      break;
    }
  }
  int j;
  j = (l+2)/2;
  for(int i = j;i<(j+1)/2;i++){
    if(s[i]!=s[j-i-1]){
      ok = 0;
      break;
    }
  }
  if(ok){cout << "Yes";}
  else cout << "No";

  return 0;
  }

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
int p[20010];

void solve() {
    int a[n], b[n];
    for (int i = 0; i < n; i++) {
        a[i] = i+1;
        b[i] = n-i;
    }

    int s[n+1], t[n+1];
    memset(s, 0, sizeof(s));
    memset(t, 0, sizeof(t));
    for (int i = 0; i < n; i++) {
        int v = n - i;
        s[p[i]+1] += v;
        s[n] -= v;
        t[0] += v;
        t[p[i]] -= v;
    }
    for (int i = 1; i <= n; i++) {
        s[i] += s[i-1];
        t[i] += t[i-1];
    }
    for (int i = 0; i < n; i++) {
        cout << a[i] + s[i];
        if (i < n-1) cout << " ";
        else cout << endl;
    }
    for (int i = 0; i < n; i++) {
        cout << b[i] + t[i];
        if (i < n-1) cout << " ";
        else cout << endl;
    }
}

void input() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
}

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

    input();
    solve();
}

Measured memory_bytes: 1152
#line 1 "d.cpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

#line 1 "../../library/union_find.cpp"
struct UnionFind {
  struct Node {
    ll parent;
    ll size;
  };
  vector<Node> tree;

  UnionFind(ll size) : tree(size) {
    for (ll i = 0; i < size; i++) {
      tree[i].parent = i;
      tree[i].size = 1;
    }
  }

  ll find(ll x) {
    while (tree[x].parent != x) {
      ll p = tree[x].parent;
      tree[x].parent = tree[p].parent;
      x = p;
    }
    return x;
  }

  void unite(ll x, ll y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (tree[x].size < tree[y].size) swap(x, y);
    tree[y].parent = x;
    tree[x].size += tree[y].size;
  }

  bool same(ll x, ll y) {
    return find(x) == find(y);
  }
};
#line 13 "d.cpp"

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

  ll n, m;
  cin >> n >> m;
  vl p(n);
  rep(i, n) {
    cin >> p[i];
  }

  UnionFind uf(n);
  rep(i, m) {
    ll x, y;
    cin >> x >> y;
    x--;
    y--;

    uf.unite(x, y);
  }

  ll ans = 0;
  rep(i, n) {
    if (uf.same(p[i]-1, i)) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int N;
  cin >> N;
  map<int, int> hist;
  for (int i=1; i<=N; i++) hist[i] = 0;
  for (int a=1; a<=100; a++) {
    for (int b=1; b<=100; b++) {
      for (int c=1; c<=100; c++) {
        int f = a*a + b*b + c*c + a*b + b*c + c*a;
        if (f <= N) hist[f]++;
      }
    }
  }
  for (int i=1; i<=N; i++) {
    cout << hist[i] << endl;
  }
}


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


int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a > b)
		swap(a,b);
	if (a > c)
		swap(a,c);
	if (b > c)
		swap(b,c);
	cout << a << " " << b << " " << c << endl;
	return 0;
}



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

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    char s[105],t[105];
    bool flag;  int len;
    scanf("%s",s);  scanf("%s",t);
    len=strlen(s);
    for(int i=0;i<=len;i++)
    {
        flag=true;
        for(int j=0;j<len;j++)
        {
            if(t[j]!=s[(i+j+len)%len])
                flag=false;
        }
        if(flag)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    var (a,b,k) = readLine()!!.split(" ").map(String::toInt)
    for(i in 1..k){
        if(i%2==1){
            a = a / 2
            b += a
        }else{
            b = b / 2
            a += b
        }

    }
    println("${a} ${b}")
}

Measured memory_bytes: 37872
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n;
	cin>>n;
	string s;
	cin>>s;
	int cnt=0;
	for(ll i=0;i<(int)s.size();i++){
		if(s[i]!=s[i+1]){
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>

using namespace std;
int N[50];
int main(){
  int n,p,p1;
 
  int i=0;
  while(true){
    cin>>n>>p;
    //ishi
    p1=p;
    if(n==0&&p==0)break;
    i=0;
    while(true){
      if(i==n)i=0;
      if(p1==0){
	p1=N[i];
	N[i]=0;
      }
      else {
	p1--;
	N[i]++;
	if(N[i]==p)break;
      }
     i++;
    }
    cout<<i<<endl; 
    N[i]=0;
    /*
    for(int i=0;i<n;i++){
      cout<<"person"<<i<<" "<<N[i]<<endl;
      }*/
  }
  return 0;
  
}

Measured memory_bytes: 864
#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>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define V vector<int>
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;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


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

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

int a[1010], dp[1010];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int k, a, b; cin >> k >> a >> b;
	if (b - a <= 2) {
		cout << k + 1 << endl;
	}
	else {
		int tmp = max((int)0,(k - (a - 1)) / 2);
		k -= tmp * 2;
		cout << 1 + k + (b - a)*tmp << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static int n;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int[][] adj = new int[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                adj[i][j] = in.nextInt();
            }
        }
        in.close();
        System.out.println(getMinimumWeight(adj));
    }

    static int minKey(int[] key, boolean[] mstSet) {
        int min = Integer.MAX_VALUE;
        int minIndex = -1;
        for (int i = 0; i < n; i++) {
            if (!mstSet[i] && key[i] < min) {
                min = key[i];
                minIndex = i;
            }
        }
        return minIndex;
    }

    static int getMinimumWeight(int[][] adj) {
        int[] cost = new int[n];
        boolean[] mstSet = new boolean[n];
        for (int i = 0; i < n; i++) {
            cost[i] = Integer.MAX_VALUE;
            mstSet[i] = false;
        }
        cost[0] = 0;
        int totalCost = 0;
        for (int i = 0; i < n; i++) {
            int minKey = minKey(cost, mstSet);
            mstSet[minKey] = true;
            for (int j = 0; j < n; j++) {
                if (adj[minKey][j] != -1 && !mstSet[j] && adj[minKey][j] < cost[j]) {
                    cost[j] = adj[minKey][j];
                }
            }
            totalCost += cost[minKey];
        }
        return totalCost;
    }
}



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

int main(){
    string s;
    cin >> s;
    int len = s.length();
    int ans = 0;

    if(len % 2 == 0){
        for(int i = 0; i < len / 2; i++){
            if(s[i] != s[len - i - 1]){
                ans++;
            }
        }
    }else{
        for(int i = 0; i < len / 2; i++){
            if(s[i] != s[len - i - 1]){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> v;
	int x;
	for(int i = 0; i < n; i++){
		cin >> x;
		v.insert(v.begin(),x);
	}
	x = 1;
	for(auto y:v){
		cout << y;
		if( x != n ){
			cout << " ";
		}
		x++;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3100
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _KTy, typename _Ty> istream& operator >> (istream& istr, pair<_KTy, _Ty>& m) { cin >> m.first >> m.second; return istr; }
template <typename _Ty> istream& operator >> (istream& istr, vector<_Ty>& v) { for (size_t i = 0; i < v.size(); i++) cin >> v[i]; return istr; }
ll modpow(ll n, ll p, ll m) { ll result = 1; while (p > 0) { if (p & 1) result = (result * n) % m; p >>= 1; n = (n * n) % m; } return result; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define fake false


#define ATOZ 26
int main() {
	bool visited[ATOZ] = {};
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (visited[S[i] - 'a']) {
			cout << "no" << endl;
			return 0;
		}
		visited[S[i] - 'a'] = true;
	}
	cout << "yes" << endl;
	return 0;
}

Measured memory_bytes: 256
from math import sqrt
class Vector:
    def __init__(self, ls):
        """ls = list"""
        self.vec = ls

    def __len__(self):
        return len(self.vec)

    def __getitem__(self, idx):
        return self.vec[idx]

    def __repr__(self):
        return f'Vector({self.vec})'

    def add(self, vec):
        """vec: Vector class"""
        assert len(self) == len(vec)
        ret = [a + b for a, b in zip(self.vec, vec.vec)]
        return Vector(ret)

    def sub(self, vec):
        """vec: Vector class"""
        assert len(self) == len(vec)
        ret = [a - b for a, b in zip(self.vec, vec.vec)]
        return Vector(ret)

    def mul(self, vec):
        """vec: Vector class"""
        assert len(self) == len(vec)
        ret = [a * b for a, b in zip(self.vec, vec.vec)]
        return Vector(ret)

    def norm(self):
        tmp = sum([x * x for x in self.vec])
        return sqrt(tmp)


def norm(vec):
    """
    vec ... Vector class
    """
    return vec.norm()


def cross(a, b):
    """
    Outer product for 2d
    a,b ... Vector class
    """
    assert len(a) == 2 and len(b) == 2
    first = a[0] * b[1]
    second = a[1] * b[0]
    return first - second


def dot(a, b):
    return sum(a.mul(b))

def resolve():
    Q = int(input())

    for i in range(Q):
        s, t, a, b, x, y, c, d = map(int, input().split())
        P0 = Vector([s, t])
        P1 = Vector([a, b])
        P2 = Vector([x, y])
        P3 = Vector([c, d])

        line_a = P1.sub(P0)
        line_b = P3.sub(P2)

        if cross(line_a, line_b) == 0:
            print(2)
        elif dot(line_a, line_b) == 0:
            print(1)
        else:
            print(0)

if __name__ == '__main__':
    resolve()



Measured memory_bytes: 5712
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> x(n, 0);
	rep(i, n) cin >> x[i];
	int sum = accumulate(x.begin(), x.end(), 0);
	sort(x.begin(), x.end(), greater<int>());
	puts(x[m-1] * m * 4 < sum ? "No" : "Yes");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd 
/****************************/
ll w[110];
ll v[110];
int n,wt;
ll dp[100][100010];
int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>wt;
	rep(i,n)
	{
		cin>>w[i]>>v[i];
	}
	memset(dp,0,sizeof(dp));
	rep(i,wt+1)
	{
		if(i>=w[0])
			dp[0][i]=v[0];
		else
			dp[0][i]=0;
	}
	rep3(i,1,n)
	{
		rep3(j,1,wt+1)
		{
			if(j<w[i])
			{
				dp[i][j]=dp[i-1][j];
			}
			if(j==w[i])
			{
				dp[i][j]=max(dp[i-1][j],v[i]);
			}
			if(j>w[i])
			{
				dp[i][j]=max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
			}
		}
	}
	/*rep(i,n)
	{
		rep3(j,1,wt+1)
		{
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<dp[n-1][wt];
	return 0;
}

Measured memory_bytes: 78336
import java.io.*;
class Main{
    public static void main (String[] args)
   	throws IOException{
	int[] data=new int[10];
	int max1,max2,max3;
       BufferedReader br=
	   new BufferedReader(new InputStreamReader(System.in));
	for(int i=0;i<10;i++){
	    String buf=br.readLine();
	    data[i]=Integer.parseInt(buf);
	}
	java.util.Arrays.sort(data);
	for(int i=9;i>=7;i--){
	    System.out.println(data[i]);
	}
	
    }
}
	    

Measured memory_bytes: 9452
N,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
a.sort()

if a[0] <= x:
    for i in a:
        x -= i
        if x < 0:
            break
        else:
            ans += 1
    if x > 0:
        ans -= 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
int main(){
    LL n,m,total_vote = 0,sel_vote = 0,if_vote = 0;
    cin >> n >> m;
    vector<LL> ary_n(n);
    for (int i = 0; i < n; i++) {
        cin >> ary_n[i];
//        cout << ary_n[i] << endl;
        total_vote += ary_n[i];
    }
    sort(ary_n.begin(),ary_n.end());
    reverse(ary_n.begin(),ary_n.end());
    
    sel_vote = 4 * m;
  	if_vote = total_vote / sel_vote;
    if(1 <= (total_vote % sel_vote)) if_vote += 1;
//    cout << total_vote << endl;    
//    cout << sel_vote << endl;
//    cout << if_vote << endl;
//    cout << ary_n[m-1] << endl;

    if(ary_n[m-1] >= if_vote ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
import collections

n, m, x = list(map(int, input().split()))
c = [0] * n
A = [[]] * n
for i in range(n):
    tmp = list(map(int, input().split()))
    c[i] = tmp[0]
    A[i] = tmp[1:]
A = np.array(A)

ok_flg = False
# 全探索
for i in range(2 ** n):
    money = 0
    skills = np.zeros(m)

    for j in range(n):
        if ((i >> j) & 1):
            money += c[j]
            skills = skills + A[j]
    if (np.all(skills >= x) and ok_flg):
        ans = min(ans, money)
    if(np.all(skills >= x) and (not ok_flg)):
        ok_flg = True
        ans = money

if (ok_flg):
    print(ans)
else:
    print(-1)


Measured memory_bytes: 27244
#include<bits/stdc++.h>
#define LL long long
#define db double

using namespace std;
LL rd()
{
	LL x=0,w=1;char ch=0;
	while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return x*w;
}
LL n,a,b;

int main()
{
	n=rd(),a=rd(),b=rd();
	if((b-a)%2==0) printf("%lld\n",(b-a)/2);
	else
	{
		LL x=a-1,y=n-b;
		if(x>y) swap(x,y);
		a=1+x,b=n-y;
		b-=a;
		printf("%lld\n",a+b/2);
	}
	return 0;
}


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

int main()
{
  int N, A;
  int res=0;
  cin >> N>>A;

  res = N*N-A;

  cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if(n == 1) {
      cout << "Hello World" << '\n';
  } else {
      int a, b;
      cin >> a >> b;
      cout << a + b << "\n";
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,e,d,i,j;
    //scanf("%lld",&a);
    //for(i=0;i<a;i++)
    //{
        scanf("%lld%lld",&b,&c);
        if(b==1||c==1)
        {
            printf("1\n");
        }


        else
        {
            printf("%lld\n",((b*c)+1)/2);
        }
    //}
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    vector<int>t(N+1);
    vector<int>x(N+1);
    vector<int>y(N+1);
    REP(i, N+1) {
        cin >> t[i] >> x[i] >> y[i];
        if (t[i]-t[i-1]<abs(x[i]-x[i-1])+abs(y[i]-y[i-1])||((t[i] - t[i - 1]) - (abs(x[i - 1] - x[i]) + abs(y[i - 1] - y[i]))) % 2 == 1) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 4580
#!/usr/bin/python
# -*- coding: utf-8 -*-

# def
def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return np.array(x)

def int_map():
    return map(int,input().split())

def int_list():
    return list(map(int,input().split()))

def print_space(l):
    return print(" ".join([str(x) for x in l]))

# import
import numpy as np
import collections as col

N = int(input())

ans = 0

for i in range(1,N):
    if N%i != 0:
        ans += N//i
    else:
        ans += N//i -1

print(ans)





Measured memory_bytes: 27148
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		vector<int> vec(3);
		for (int j = 0; j < 3; j++) {
			cin >> vec[j];
		}
		sort(vec.begin(), vec.end());
		if (pow(vec[0], 2) + pow(vec[1], 2) == pow(vec[2], 2)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3148
#include <stdio.h>
#define N 20
int main(){
  int i,j,x,y,n,step,gems,xy[N+1][N+1],rx,ry,count;
  char dir;
  while(1){
    for(i=0;i<N+1;i++){
      for(j=0;j<N+1;j++){
    xy[i][j] = 0;
      }
    }
    rx = 10;
    ry = 10;
    count = 0;
 
    scanf("%d",&n);
    if( n==0 ) break;
    gems = n;
    for(i=0;i<n;i++){
      scanf("%d %d",&x,&y);
      xy[y][x] = 1;
    }
 
    scanf("%d",&n);
    for(j=0;j<n;j++){
      scanf(" %c %d",&dir,&step);
      if( dir == 'E'){
    for(i=rx;i<=rx+step;i++){
      if( xy[ry][i] == 1 ){
        count++;
        xy[ry][i] = 0;
      }
    }
    rx = i-1;
      }
      else if( dir == 'W'){
    for(i=rx;i>=rx-step;i--){
      if( xy[ry][i] == 1 ){
        count++;
        xy[ry][i] = 0;
      }
    }
    rx = i+1;
      }
      else if( dir == 'N' ){
    for(i=ry;i<=ry+step;i++){
      if( xy[i][rx] == 1 ) {
        count++;
        xy[i][rx] = 0;
      }
    }
    ry = i-1;
      }
      else if( dir == 'S' ){
    for(i=ry;i>=ry-step;i--){
      if( xy[i][rx] == 1 ) {
        count++;
        xy[i][rx] = 0;
      }
    }
    ry = i+1;
      }
    }
    if( count == gems ){
      printf("Yes\n");
    }
    else{
      printf("No\n");
 
    }
  }
  return 0;
}

Measured memory_bytes: 2500
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

int n,x,a,b;

int32_t main(){
    ios_base :: sync_with_stdio(0);
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> x;
        if(x%2) a++;
        else if(!(x%4)) b++;
    }
    if(b>=a) cout << "Yes";
    else if(b==a-1 && a+b==n) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256